Refactor Game Modes (#5857)

This commit is contained in:
Vera Aguilera Puerto
2021-12-21 21:23:29 +01:00
committed by GitHub
parent d1a1ee3cbe
commit f4d8ec1b35
62 changed files with 2087 additions and 1804 deletions

View File

@@ -1,10 +1,14 @@
using System.Collections.Generic;
using Content.Server.GameTicking;
using Content.Server.GameTicking.Rules;
using Content.Server.Holiday.Greet;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.List;
using Robust.Shared.ViewVariables;
namespace Content.Server.Spawners.Components
@@ -18,11 +22,11 @@ namespace Content.Server.Spawners.Components
public override string Name => "ConditionalSpawner";
[ViewVariables(VVAccess.ReadWrite)]
[DataField("prototypes")]
[DataField("prototypes", customTypeSerializer:typeof(PrototypeIdListSerializer<EntityPrototype>))]
public List<string> Prototypes { get; set; } = new();
[ViewVariables(VVAccess.ReadWrite)]
[DataField("gameRules")]
[DataField("gameRules", customTypeSerializer:typeof(PrototypeIdListSerializer<GameRulePrototype>))]
private readonly List<string> _gameRules = new();
[ViewVariables(VVAccess.ReadWrite)]
@@ -31,7 +35,7 @@ namespace Content.Server.Spawners.Components
public void RuleAdded(GameRuleAddedEvent obj)
{
if(_gameRules.Contains(obj.Rule.GetType().Name))
if(_gameRules.Contains(obj.Rule.ID))
Spawn();
}