Container light occlusion (#687)

Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
L.E.D
2020-07-26 08:25:53 -04:00
committed by GitHub
parent 8e08c64fcf
commit d3866a3372
3 changed files with 182 additions and 1 deletions

View File

@@ -3,7 +3,6 @@ using System;
using System.Collections.Generic;
using System.Linq;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.Interfaces.GameObjects;
using Content.Server.Interfaces.GameObjects.Components.Interaction;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Server.Utility;
@@ -46,6 +45,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
private Container? _storage;
private bool _occludesLight;
private bool _storageInitialCalculated;
private int _storageUsed;
private int _storageCapacityMax;
@@ -53,6 +53,16 @@ namespace Content.Server.GameObjects.Components.Items.Storage
public IReadOnlyCollection<IEntity>? StoredEntities => _storage?.ContainedEntities;
public bool OccludesLight
{
get => _occludesLight;
set
{
_occludesLight = value;
if (_storage != null) _storage.OccludesLight = value;
}
}
private void EnsureInitialCalculated()
{
if (_storageInitialCalculated)
@@ -318,6 +328,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
// ReSharper disable once StringLiteralTypo
_storage = ContainerManagerComponent.Ensure<Container>("storagebase", Owner);
_storage.OccludesLight = _occludesLight;
}
public override void ExposeData(ObjectSerializer serializer)
@@ -325,6 +336,7 @@ namespace Content.Server.GameObjects.Components.Items.Storage
base.ExposeData(serializer);
serializer.DataField(ref _storageCapacityMax, "capacity", 10000);
serializer.DataField(ref _occludesLight, "occludesLight", true);
//serializer.DataField(ref StorageUsed, "used", 0);
}