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()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.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)
|
if (component.RandomTrigger)
|
||||||
{
|
{
|
||||||
@@ -33,6 +33,12 @@ public sealed class ArtifactSystem : EntitySystem
|
|||||||
var trigger = (Component) _componentFactory.GetComponent(triggerName);
|
var trigger = (Component) _componentFactory.GetComponent(triggerName);
|
||||||
trigger.Owner = uid;
|
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);
|
EntityManager.AddComponent(uid, trigger);
|
||||||
RaiseLocalEvent(uid, new RandomizeTriggerEvent());
|
RaiseLocalEvent(uid, new RandomizeTriggerEvent());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ entities:
|
|||||||
-1,-1:
|
-1,-1:
|
||||||
0:
|
0:
|
||||||
color: '#9FED5896'
|
color: '#9FED5896'
|
||||||
id: antilizard
|
id: prolizard
|
||||||
coordinates: -2,-4
|
coordinates: -2,-4
|
||||||
type: DecalGrid
|
type: DecalGrid
|
||||||
- tiles:
|
- tiles:
|
||||||
@@ -759,13 +759,6 @@ entities:
|
|||||||
- pos: -0.5,-0.5
|
- pos: -0.5,-0.5
|
||||||
parent: 52
|
parent: 52
|
||||||
type: Transform
|
type: Transform
|
||||||
- gas: Plasma
|
|
||||||
possibleGas:
|
|
||||||
- Oxygen
|
|
||||||
- Plasma
|
|
||||||
- Nitrogen
|
|
||||||
- CarbonDioxide
|
|
||||||
type: ArtifactGasTrigger
|
|
||||||
- uid: 80
|
- uid: 80
|
||||||
type: Stool
|
type: Stool
|
||||||
components:
|
components:
|
||||||
|
|||||||
Reference in New Issue
Block a user