Refactor Game Modes (#5819)
This commit is contained in:
committed by
GitHub
parent
8be5c25bd4
commit
8831d08229
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user