예제 #1
0
        private void OnComponentInit(EntityUid uid, ServerStorageComponent storageComp, ComponentInit args)
        {
            base.Initialize();

            // ReSharper disable once StringLiteralTypo
            storageComp.Storage = _containerSystem.EnsureContainer <Container>(uid, "storagebase");
            storageComp.Storage.OccludesLight = storageComp.OccludesLight;
            UpdateStorageVisualization(uid, storageComp);
            RecalculateStorageUsed(storageComp);
            UpdateStorageUI(uid, storageComp);
        }
    private void OnInit(EntityUid uid, EntityStorageComponent component, ComponentInit args)
    {
        component.Contents = _container.EnsureContainer <Container>(uid, ContainerName);
        component.Contents.ShowContents  = component.ShowContents;
        component.Contents.OccludesLight = component.OccludesLight;

        if (TryComp <ConstructionComponent>(uid, out var construction))
        {
            _construction.AddContainer(uid, nameof(EntityStorageComponent), construction);
        }

        if (TryComp <PlaceableSurfaceComponent>(uid, out var placeable))
        {
            _placeableSurface.SetPlaceable(uid, component.Open, placeable);
        }
    }