* Expose more private values of Solution and SolutionComponent Expose SolutionComponent.ContainedSolution and Solution.Contents. Both needed by ReagentDispenserComponent. * Implement IExamine for SolutionComponent Allows players to see the contents of a solution by examining the entity which contains it. * Implement ReagentDispenserComponent Adds ReagentDispenserComponent. A component which can add or remove reagents from a solution container. It's written in a general way so that it can be used for things such as the Chemical dispensers in chemistry, but also the booze and soda dispensers in the bar. The chemicals it may dispense are defined in yaml, similar to the way that vending machines define which entities they can dispense, by defining a reagent pack. * Add chemical dispenser and equipment Adds the chemical dispenser, beaker, large beaker, dropper, and a few more chemicals. * Add booze and soda dispensers. Adds the booze and soda dispensers, and a few chemicals for them to dispense. There's no drink mixing or drunkenness yet. * Update engine submodule. * Remove unneeded and commented out code Had a few WIP notes and debug code bits I forgot to remove beforehand. * Make SolutionComponent._containedSolution and it's values private again - Remove `SolutionComponent.ContainedSolution` property, replace with specific access functions to maintain safety. - Make Solution.Contents return a `ReadOnlyCollection` instead of `_contents` to prevent uncontrolled access to the Solution values. - Add `SolutionComponent.RemoveAllSolution()` * Update Content.Shared/Chemistry/Solution.cs Commits a suggestion from RemieRichards to match the coding style of the rest of the codebase. Using `IReadOnlyList` instead of `IReadOnlyCollection`. Co-Authored-By: Remie Richards <remierichards@gmail.com> * Update Content.Shared/GameObjects/Components/Chemistry/SolutionComponent.cs Commits a suggestion from RemieRichards to match the coding style of the rest of the codebase. Using `IReadOnlyList` instead of `IReadOnlyCollection`. Co-Authored-By: Remie Richards <remierichards@gmail.com> * Add import for IReadOnlyList to Shared/SolutionComponent.cs * Add documentation * Improve localization Improve use of ILocalizationManager. * Resolve ReagentDispenserWindow._localizationManager before using it Forgot to do this in the last commit, resulting in a crash. Oops. * Add SolutionCaps.FitsInDispenser. Use in ReagentDispenserComponent. Used to limit large containers like buckets or mop buckets from being placed in a dispenser. Both have large capacities (500) and weren't designed to hold certain chemicals like a beaker is, so for now they can be blocked from being put in a dispenser by giving them that flag. * Add colors to new reagents * Update engine submodule
221 lines
7.7 KiB
C#
221 lines
7.7 KiB
C#
using System;
|
|
using Content.Client.Chat;
|
|
using Content.Client.GameObjects.Components.Actor;
|
|
using Content.Client.GameTicking;
|
|
using Content.Client.Input;
|
|
using Content.Client.Interfaces;
|
|
using Content.Client.Interfaces.Chat;
|
|
using Content.Client.Interfaces.Parallax;
|
|
using Content.Client.Parallax;
|
|
using Content.Client.Sandbox;
|
|
using Content.Client.UserInterface;
|
|
using Content.Shared.GameObjects.Components;
|
|
using Content.Shared.GameObjects.Components.Chemistry;
|
|
using Content.Shared.GameObjects.Components.Markers;
|
|
using Content.Shared.GameObjects.Components.Research;
|
|
using Content.Shared.GameObjects.Components.VendingMachines;
|
|
using Content.Shared.Interfaces;
|
|
using Robust.Client.Interfaces;
|
|
using Robust.Client.Interfaces.Graphics.Overlays;
|
|
using Robust.Client.Interfaces.Input;
|
|
using Robust.Client.Interfaces.UserInterface;
|
|
using Robust.Client.Player;
|
|
using Robust.Shared.ContentPack;
|
|
using Robust.Shared.Interfaces.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Timing;
|
|
|
|
namespace Content.Client
|
|
{
|
|
public class EntryPoint : GameClient
|
|
{
|
|
#pragma warning disable 649
|
|
[Dependency] private readonly IPlayerManager _playerManager;
|
|
[Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner;
|
|
#pragma warning restore 649
|
|
|
|
public override void Init()
|
|
{
|
|
var factory = IoCManager.Resolve<IComponentFactory>();
|
|
var prototypes = IoCManager.Resolve<IPrototypeManager>();
|
|
|
|
factory.DoAutoRegistrations();
|
|
|
|
var registerIgnore = new[]
|
|
{
|
|
"AmmoBox",
|
|
"Breakable",
|
|
"Pickaxe",
|
|
"Interactable",
|
|
"Destructible",
|
|
"Temperature",
|
|
"PowerTransfer",
|
|
"PowerNode",
|
|
"PowerProvider",
|
|
"PowerDevice",
|
|
"PowerStorage",
|
|
"PowerGenerator",
|
|
"Explosive",
|
|
"OnUseTimerTrigger",
|
|
"ToolboxElectricalFill",
|
|
"ToolLockerFill",
|
|
"EmitSoundOnUse",
|
|
"FootstepModifier",
|
|
"HeatResistance",
|
|
"Teleportable",
|
|
"ItemTeleporter",
|
|
"Portal",
|
|
"EntityStorage",
|
|
"PlaceableSurface",
|
|
"Wirecutter",
|
|
"Screwdriver",
|
|
"Multitool",
|
|
"Welder",
|
|
"Wrench",
|
|
"Crowbar",
|
|
"HitscanWeapon",
|
|
"ProjectileWeapon",
|
|
"Projectile",
|
|
"MeleeWeapon",
|
|
"Storeable",
|
|
"Stack",
|
|
"Dice",
|
|
"Construction",
|
|
"Apc",
|
|
"Door",
|
|
"PoweredLight",
|
|
"Smes",
|
|
"Powercell",
|
|
"HandheldLight",
|
|
"LightBulb",
|
|
"Healing",
|
|
"Catwalk",
|
|
"BallisticMagazine",
|
|
"BallisticMagazineWeapon",
|
|
"BallisticBullet",
|
|
"HitscanWeaponCapacitor",
|
|
"PowerCell",
|
|
"AiController",
|
|
"PlayerInputMover",
|
|
"Computer",
|
|
"AsteroidRock",
|
|
"ResearchServer",
|
|
"ResearchPointSource",
|
|
"ResearchClient",
|
|
"IdCard",
|
|
"Access",
|
|
"AccessReader",
|
|
"IdCardConsole",
|
|
"Airlock",
|
|
"MedicalScanner",
|
|
"WirePlacer",
|
|
};
|
|
|
|
foreach (var ignoreName in registerIgnore)
|
|
{
|
|
factory.RegisterIgnore(ignoreName);
|
|
}
|
|
|
|
factory.Register<SharedResearchConsoleComponent>();
|
|
factory.Register<SharedLatheComponent>();
|
|
factory.Register<SharedSpawnPointComponent>();
|
|
|
|
factory.Register<SolutionComponent>();
|
|
|
|
factory.Register<SharedVendingMachineComponent>();
|
|
factory.Register<SharedWiresComponent>();
|
|
|
|
factory.Register<SharedReagentDispenserComponent>();
|
|
|
|
prototypes.RegisterIgnore("material");
|
|
|
|
IoCManager.Register<IGameHud, GameHud>();
|
|
IoCManager.Register<IClientNotifyManager, ClientNotifyManager>();
|
|
IoCManager.Register<ISharedNotifyManager, ClientNotifyManager>();
|
|
IoCManager.Register<IClientGameTicker, ClientGameTicker>();
|
|
IoCManager.Register<IParallaxManager, ParallaxManager>();
|
|
IoCManager.Register<IChatManager, ChatManager>();
|
|
IoCManager.Register<IEscapeMenuOwner, EscapeMenuOwner>();
|
|
IoCManager.Register<ISandboxManager, SandboxManager>();
|
|
|
|
if (TestingCallbacks != null)
|
|
{
|
|
var cast = (ClientModuleTestingCallbacks) TestingCallbacks;
|
|
cast.ClientBeforeIoC?.Invoke();
|
|
}
|
|
|
|
IoCManager.BuildGraph();
|
|
|
|
IoCManager.Resolve<IParallaxManager>().LoadParallax();
|
|
IoCManager.Resolve<IBaseClient>().PlayerJoinedServer += SubscribePlayerAttachmentEvents;
|
|
|
|
var stylesheet = new NanoStyle();
|
|
|
|
IoCManager.Resolve<IUserInterfaceManager>().Stylesheet = stylesheet.Stylesheet;
|
|
IoCManager.Resolve<IUserInterfaceManager>().Stylesheet = stylesheet.Stylesheet;
|
|
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
_escapeMenuOwner.Initialize();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Subscribe events to the player manager after the player manager is set up
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="args"></param>
|
|
public void SubscribePlayerAttachmentEvents(object sender, EventArgs args)
|
|
{
|
|
_playerManager.LocalPlayer.EntityAttached += AttachPlayerToEntity;
|
|
_playerManager.LocalPlayer.EntityDetached += DetachPlayerFromEntity;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Add the character interface master which combines all character interfaces into one window
|
|
/// </summary>
|
|
public static void AttachPlayerToEntity(EntityAttachedEventArgs eventArgs)
|
|
{
|
|
eventArgs.NewEntity.AddComponent<CharacterInterface>();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Remove the character interface master from this entity now that we have detached ourselves from it
|
|
/// </summary>
|
|
public static void DetachPlayerFromEntity(EntityDetachedEventArgs eventArgs)
|
|
{
|
|
eventArgs.OldEntity.RemoveComponent<CharacterInterface>();
|
|
}
|
|
|
|
public override void PostInit()
|
|
{
|
|
base.PostInit();
|
|
|
|
// Setup key contexts
|
|
var inputMan = IoCManager.Resolve<IInputManager>();
|
|
ContentContexts.SetupContexts(inputMan.Contexts);
|
|
|
|
IoCManager.Resolve<IGameHud>().Initialize();
|
|
IoCManager.Resolve<IClientNotifyManager>().Initialize();
|
|
IoCManager.Resolve<IClientGameTicker>().Initialize();
|
|
IoCManager.Resolve<IOverlayManager>().AddOverlay(new ParallaxOverlay());
|
|
IoCManager.Resolve<IChatManager>().Initialize();
|
|
IoCManager.Resolve<ISandboxManager>().Initialize();
|
|
}
|
|
|
|
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
|
|
{
|
|
base.Update(level, frameEventArgs);
|
|
|
|
switch (level)
|
|
{
|
|
case ModUpdateLevel.FramePreEngine:
|
|
IoCManager.Resolve<IClientNotifyManager>().FrameUpdate(frameEventArgs);
|
|
IoCManager.Resolve<IClientGameTicker>().FrameUpdate(frameEventArgs);
|
|
IoCManager.Resolve<IChatManager>().FrameUpdate(frameEventArgs);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|