Exemplo n.º 1
0
    private void OnConsoleUnlock(EntityUid uid, ResearchConsoleComponent component, ConsoleUnlockTechnologyMessage args)
    {
        if (!TryComp <TechnologyDatabaseComponent>(uid, out var database) ||
            !TryComp <ResearchClientComponent>(uid, out var client) ||
            !this.IsPowered(uid, EntityManager))
        {
            return;
        }

        if (!_prototypeManager.TryIndex(args.Id, out TechnologyPrototype? tech) ||
            client.Server == null ||
            !CanUnlockTechnology(client.Server, tech))
        {
            return;
        }

        if (!UnlockTechnology(client.Server, tech))
        {
            return;
        }

        SyncWithServer(database);
        Dirty(database);
        UpdateConsoleInterface(component);
    }
Exemplo n.º 2
0
    private void UpdateConsoleInterface(ResearchConsoleComponent component, ResearchClientComponent?clientComponent = null)
    {
        ResearchConsoleBoundInterfaceState state;

        if (!Resolve(component.Owner, ref clientComponent, false) ||
            clientComponent.Server == null)
        {
            state = new ResearchConsoleBoundInterfaceState(default, default);
Exemplo n.º 3
0
    private void OnConsoleSelect(EntityUid uid, ResearchConsoleComponent component, ConsoleServerSelectionMessage args)
    {
        if (!HasComp <TechnologyDatabaseComponent>(uid) ||
            !HasComp <ResearchClientComponent>(uid) ||
            !this.IsPowered(uid, EntityManager))
        {
            return;
        }

        _uiSystem.TryOpen(uid, ResearchClientUiKey.Key, (IPlayerSession)args.Session);
    }
Exemplo n.º 4
0
    private void OnConsoleSync(EntityUid uid, ResearchConsoleComponent component, ConsoleServerSyncMessage args)
    {
        if (!TryComp <TechnologyDatabaseComponent>(uid, out var database) ||
            !HasComp <ResearchClientComponent>(uid) ||
            !this.IsPowered(uid, EntityManager))
        {
            return;
        }

        SyncWithServer(database);
        UpdateConsoleInterface(component);
    }