Move random artifact trigger adding to mapinit (#7267)
This commit is contained in:
@@ -13,10 +13,10 @@ public sealed class ArtifactSystem : EntitySystem
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<ArtifactComponent, ComponentInit>(OnInit);
|
||||
SubscribeLocalEvent<ArtifactComponent, MapInitEvent>(OnInit);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, ArtifactComponent component, ComponentInit args)
|
||||
private void OnInit(EntityUid uid, ArtifactComponent component, MapInitEvent args)
|
||||
{
|
||||
if (component.RandomTrigger)
|
||||
{
|
||||
@@ -33,6 +33,12 @@ public sealed class ArtifactSystem : EntitySystem
|
||||
var trigger = (Component) _componentFactory.GetComponent(triggerName);
|
||||
trigger.Owner = uid;
|
||||
|
||||
if (EntityManager.HasComponent(uid, trigger.GetType()))
|
||||
{
|
||||
Logger.Error($"Attempted to add a random artifact trigger ({triggerName}) to an entity ({ToPrettyString(uid)}), but it already has the trigger");
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager.AddComponent(uid, trigger);
|
||||
RaiseLocalEvent(uid, new RandomizeTriggerEvent());
|
||||
}
|
||||
|
||||
@@ -422,7 +422,7 @@ entities:
|
||||
-1,-1:
|
||||
0:
|
||||
color: '#9FED5896'
|
||||
id: antilizard
|
||||
id: prolizard
|
||||
coordinates: -2,-4
|
||||
type: DecalGrid
|
||||
- tiles:
|
||||
@@ -759,13 +759,6 @@ entities:
|
||||
- pos: -0.5,-0.5
|
||||
parent: 52
|
||||
type: Transform
|
||||
- gas: Plasma
|
||||
possibleGas:
|
||||
- Oxygen
|
||||
- Plasma
|
||||
- Nitrogen
|
||||
- CarbonDioxide
|
||||
type: ArtifactGasTrigger
|
||||
- uid: 80
|
||||
type: Stool
|
||||
components:
|
||||
|
||||
Reference in New Issue
Block a user