diff --git a/Content.Server/Chat/Systems/ChatSystem.cs b/Content.Server/Chat/Systems/ChatSystem.cs index 262717d9aeb..15aa56c39f1 100644 --- a/Content.Server/Chat/Systems/ChatSystem.cs +++ b/Content.Server/Chat/Systems/ChatSystem.cs @@ -585,7 +585,7 @@ private void SendEntityWhisper( _chatManager.ChatMessageToOne(ChatChannel.Whisper, understand ? msg.OriginalMessage : msg.Message, understand ? wrappedMessage : wrappedLanguageMessage, source, false, session.Channel); //If listener is too far, they only hear fragments of the message else if (_examineSystem.InRangeUnOccluded(source, listener, WhisperMuffledRange)) - _chatManager.ChatMessageToOne(ChatChannel.Whisper, obfuscatedMessage, wrappedobfuscatedMessage, source, false, session.Channel); + _chatManager.ChatMessageToOne(ChatChannel.Whisper, obfuscatedMessage, wrappedObfuscatedMessage, source, false, session.Channel); //If listener is too far and has no line of sight, they can't identify the whisperer's identity else _chatManager.ChatMessageToOne(ChatChannel.Whisper, understand ? obfuscatedMessage : obfuscatedLanguageMessage, understand ? wrappedUnknownMessage : wrappedUnknownLanguageMessage, source, false, session.Channel); diff --git a/Content.Server/Construction/Components/WelderRefinableComponent.cs b/Content.Server/Construction/Components/WelderRefinableComponent.cs new file mode 100644 index 00000000000..bde28253646 --- /dev/null +++ b/Content.Server/Construction/Components/WelderRefinableComponent.cs @@ -0,0 +1,24 @@ +using Content.Shared.Tools; +using Robust.Shared.Prototypes; + +namespace Content.Server.Construction.Components; + +/// +/// Used for something that can be refined by welder. +/// For example, glass shard can be refined to glass sheet. +/// +[RegisterComponent] +public sealed partial class WelderRefinableComponent : Component +{ + [DataField] + public HashSet? RefineResult = new(); + + [DataField] + public float RefineTime = 2f; + + [DataField] + public float RefineFuel; + + [DataField] + public ProtoId QualityNeeded = "Welding"; +} diff --git a/Content.Server/Construction/RefiningSystem.cs b/Content.Server/Construction/RefiningSystem.cs new file mode 100644 index 00000000000..2976c8b4cf6 --- /dev/null +++ b/Content.Server/Construction/RefiningSystem.cs @@ -0,0 +1,50 @@ +using Content.Server.Construction.Components; +using Content.Server.Stack; +using Content.Shared.Construction; +using Content.Shared.Interaction; +using Content.Shared.Stacks; +using SharedToolSystem = Content.Shared.Tools.Systems.SharedToolSystem; + +namespace Content.Server.Construction +{ + public sealed class RefiningSystem : EntitySystem + { + [Dependency] private readonly SharedToolSystem _toolSystem = default!; + [Dependency] private readonly StackSystem _stackSystem = default!; + public override void Initialize() + { + base.Initialize(); + SubscribeLocalEvent(OnInteractUsing); + SubscribeLocalEvent(OnDoAfter); + } + + private void OnInteractUsing(EntityUid uid, WelderRefinableComponent component, InteractUsingEvent args) + { + if (args.Handled) + return; + + args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, component.RefineTime, component.QualityNeeded, new WelderRefineDoAfterEvent(), fuel: component.RefineFuel); + } + + private void OnDoAfter(EntityUid uid, WelderRefinableComponent component, WelderRefineDoAfterEvent args) + { + if (args.Cancelled) + return; + + // get last owner coordinates and delete it + var resultPosition = Transform(uid).Coordinates; + EntityManager.DeleteEntity(uid); + + // spawn each result after refine + foreach (var result in component.RefineResult!) + { + var droppedEnt = Spawn(result, resultPosition); + + // TODO: If something has a stack... Just use a prototype with a single thing in the stack. + // This is not a good way to do it. + if (TryComp(droppedEnt, out var stack)) + _stackSystem.SetCount(droppedEnt, 1, stack); + } + } + } +} diff --git a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs index 193766cc6a0..97ba4561f4c 100644 --- a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs +++ b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs @@ -3,6 +3,7 @@ using System.Threading; using System.Threading.Tasks; using Content.Corvax.Interfaces.Server; +using Content.Corvax.Interfaces.Shared; using Content.Server.Administration.Logs; using Content.Server.Database; using Content.Shared.CCVar; @@ -32,6 +33,7 @@ public sealed class ServerPreferencesManager : IServerPreferencesManager, IPostI [Dependency] private readonly IPrototypeManager _protos = default!; [Dependency] private readonly ILogManager _log = default!; [Dependency] private readonly UserDbDataManager _userDb = default!; + private ISharedSponsorsManager? _sponsors; // Cache player prefs on the server so we don't need as much async hell related to them. private readonly Dictionary _cachedPlayerPrefs = @@ -102,41 +104,13 @@ public async Task SetProfile(NetUserId userId, int slot, ICharacterProfile profi return; } - if (slot < 0 || slot >= GetMaxUserCharacterSlots(userId)) // Corvax-Sponsors - { + if (slot < 0 || slot >= MaxCharacterSlots) return; - } + var curPrefs = prefsData.Prefs!; var session = _playerManager.GetSessionById(userId); - - if (profile is HumanoidCharacterProfile humanoid) - if (curPrefs.Characters.TryGetValue(slot, out var storedProfile) && storedProfile is HumanoidCharacterProfile storedHumanoid) - { - if (humanoid.BankBalance != storedHumanoid.BankBalance) - { - _log.Add(LogType.UpdateCharacter, LogImpact.High, - $"Character update with wrong balance from {message.MsgChannel.UserName}, current balance: {storedHumanoid.BankBalance}, tried to set: {humanoid.BankBalance}"); - - return; - } - } - else if (humanoid.BankBalance != HumanoidCharacterProfile.DefaultBalance) - { - _log.Add(LogType.UpdateCharacter, LogImpact.High, - $"Character creation with wrong balance from {message.MsgChannel.UserName}, default balance: {HumanoidCharacterProfile.DefaultBalance}, tried to set: {humanoid.BankBalance}"); - - return; - } - - _log.Add(LogType.UpdateCharacter, LogImpact.Low, $"Successful character update from {message.MsgChannel.UserName}"); - - // Corvax-Sponsors-Start: Ensure removing sponsor markings if client somehow bypassed client filtering - // WARN! It's not removing markings from DB! - var sponsorPrototypes = _sponsors != null && _sponsors.TryGetPrototypes(message.MsgChannel.UserId, out var prototypes) - ? prototypes.ToArray() - : []; + var sponsorPrototypes = _sponsors != null && _sponsors.TryGetServerPrototypes(session.UserId, out var prototypes) ? prototypes.ToArray() : []; // Corvax-Sponsors profile.EnsureValid(session, _dependencies, sponsorPrototypes); - // Corvax-Sponsors-End var profiles = new Dictionary(curPrefs.Characters) { @@ -267,7 +241,7 @@ public bool HavePreferencesLoaded(ICommonSession session) private int GetMaxUserCharacterSlots(NetUserId userId) { var maxSlots = _cfg.GetCVar(CCVars.GameMaxCharacterSlots); - var extraSlots = _sponsors?.GetExtraCharSlots(userId) ?? 0; + var extraSlots = _sponsors?.GetServerExtraCharSlots(userId) ?? 0; return maxSlots + extraSlots; } // Corvax-Sponsors-End diff --git a/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs b/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs index 746d75f0d85..01d838bb58d 100644 --- a/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs +++ b/Content.Server/Silicons/Borgs/BorgSystem.Modules.cs @@ -1,3 +1,4 @@ +using System.Diagnostics; using System.Linq; using Content.Shared.Hands.Components; using Content.Shared.Interaction.Components; @@ -61,6 +62,7 @@ private void OnSelectableInstalled(EntityUid uid, SelectableBorgModuleComponent if (_actions.AddAction(chassis, ref component.ModuleSwapActionEntity, out var action, component.ModuleSwapActionId, uid)) { action.EntityIcon = uid; + Dirty(component.ModuleSwapActionEntity.Value, action); } diff --git a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs index aad8b3d9ca0..3d4448b6954 100644 --- a/Content.Server/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Server/Weapons/Ranged/Systems/GunSystem.cs @@ -156,7 +156,7 @@ protected override bool ShootDirect(EntityUid gunUid, GunComponent gun, EntityUi { if (!Deleted(hitEntity)) { - if (dmg.Any()) + if (dmg.AnyPositive()) //Corvax { _color.RaiseEffect(Color.Red, new List() { hitEntity }, Filter.Pvs(hitEntity, entityManager: EntityManager)); } diff --git a/Content.Server/_NF/Bank/BankSystem.cs b/Content.Server/_NF/Bank/BankSystem.cs index 5e65054842e..2c190cb9f9a 100644 --- a/Content.Server/_NF/Bank/BankSystem.cs +++ b/Content.Server/_NF/Bank/BankSystem.cs @@ -8,6 +8,7 @@ using Robust.Shared.Network; using Content.Server.Cargo.Components; using Content.Shared._NF.Bank.Events; +using Content.Shared.Database; using Robust.Server.Player; using Content.Shared.Preferences.Loadouts; using Robust.Shared.Prototypes; diff --git a/Content.Shared/Actions/BaseActionComponent.cs b/Content.Shared/Actions/BaseActionComponent.cs index ff2a121ab39..a26ada0b398 100644 --- a/Content.Shared/Actions/BaseActionComponent.cs +++ b/Content.Shared/Actions/BaseActionComponent.cs @@ -10,8 +10,8 @@ namespace Content.Shared.Actions; // TODO add access attribute. Need to figure out what to do with decal & mapping actions. -//[EntityCategory("Actions")]//Corvax-Frontier change after upstream 020724 -[Access(typeof(SharedActionsSystem))] //Before upstream 020724 +[EntityCategory("Actions")] +//[Access(typeof(SharedActionsSystem))] //Before upstream 020724 public abstract partial class BaseActionComponent : Component { public abstract BaseActionEvent? BaseEvent { get; } @@ -102,6 +102,8 @@ public abstract partial class BaseActionComponent : Component /// Entity to use for the action icon. If no entity is provided and the differs from /// , then it will default to using /// + + [ViewVariables(VVAccess.ReadWrite)] public EntityUid? EntityIcon { get diff --git a/Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs b/Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs index c16593a9fb7..52f9d4ca7b7 100644 --- a/Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs +++ b/Content.Shared/Humanoid/Prototypes/SpeciesPrototype.cs @@ -31,7 +31,7 @@ public sealed partial class SpeciesPrototype : IPrototype /// [DataField(required: true)] public bool RoundStart { get; private set; } = false; - + // Corvax-Sponsors-Start /// /// Whether the species is available only for sponsors diff --git a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs index 64c60436f64..57f312a09b5 100644 --- a/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs +++ b/Content.Shared/Humanoid/SharedHumanoidAppearanceSystem.cs @@ -1,5 +1,6 @@ using System.IO; using System.Linq; +using Content.Corvax.Interfaces.Shared; using Content.Shared.CCVar; using Content.Shared.Decals; using Content.Shared.Examine; @@ -36,6 +37,7 @@ public abstract class SharedHumanoidAppearanceSystem : EntitySystem [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly ISerializationManager _serManager = default!; [Dependency] private readonly MarkingManager _markingManager = default!; + private ISharedSponsorsManager? _sponsors; [ValidatePrototypeId] public const string DefaultSpecies = "Human"; @@ -75,7 +77,8 @@ public HumanoidCharacterProfile FromStream(Stream stream, ICommonSession session var profile = export.Profile; var collection = IoCManager.Instance; - profile.EnsureValid(session, collection!); + var sponsorPrototypes = _sponsors != null && _sponsors.TryGetServerPrototypes(session.UserId, out var prototypes) ? prototypes.ToArray() : []; // Corvax-Sponsors + profile.EnsureValid(session, collection!, sponsorPrototypes); return profile; } diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index 34fc50e8140..83d8b2dc57c 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -91,7 +91,7 @@ public sealed partial class HumanoidCharacterProfile : ICharacterProfile [DataField] public Gender Gender { get; private set; } = Gender.Male; - + [DataField] // Frontier: Bank balance public int BankBalance { get; private set; } = DefaultBalance; // Frontier: Bank balance @@ -491,7 +491,7 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection } // Corvax-Sponsors-Start: Reset to human if player not sponsor - if (speciesPrototype.SponsorOnly && !sponsorPrototypes.Contains(Species)) + if (speciesPrototype.SponsorOnly && !sponsorPrototypes.Contains(Species.Id)) { Species = SharedHumanoidAppearanceSystem.DefaultSpecies; speciesPrototype = prototypeManager.Index(Species); @@ -640,6 +640,13 @@ public void EnsureValid(ICommonSession session, IDependencyCollection collection _traitPreferences.Clear(); _traitPreferences.UnionWith(traits); + + // // Corvax-TTS-Start + // prototypeManager.TryIndex(Voice, out var voice); + // if (voice is null || !CanHaveVoice(voice, Sex)) + // Voice = SharedHumanoidAppearanceSystem.DefaultSexVoice[sex]; + // // Corvax-TTS-End + // Checks prototypes exist for all loadouts and dump / set to default if not. var toRemove = new ValueList(); diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index d30c98cb9ef..3b58c338a77 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -142,7 +142,7 @@ private void OnShootRequest(RequestShootEvent msg, EntitySessionEventArgs args) gun.ShootCoordinates = GetCoordinates(msg.Coordinates); gun.Target = GetEntity(msg.Target); - AttemptShoot(user.Value, ent, gun); + AttemptShoot(user.Value, gun); } private void OnStopShootRequest(RequestStopShootEvent ev, EntitySessionEventArgs args)