Пример #1
0
        private void OnGridAdd(EntityUid uid, MapGridComponent component, ComponentAdd args)
        {
            // GridID is not set yet so we don't include it.
            var msg = new GridAddEvent(uid);

            EntityManager.EventBus.RaiseLocalEvent(uid, msg);
        }
Пример #2
0
 private void OnShuttleAdd(EntityUid uid, ShuttleComponent component, ComponentAdd args)
 {
     // Easier than doing it in the comp and they don't have constructors.
     for (var i = 0; i < component.LinearThrusters.Length; i++)
     {
         component.LinearThrusters[i] = new List <ThrusterComponent>();
     }
 }
    private void SetupKudzu(EntityUid uid, GrowingKudzuComponent component, ComponentAdd args)
    {
        if (!EntityManager.TryGetComponent <AppearanceComponent>(uid, out var appearance))
        {
            return;
        }

        appearance.SetData(KudzuVisuals.Variant, _robustRandom.Next(1, 3));
        appearance.SetData(KudzuVisuals.GrowthLevel, 1);
    }
Пример #4
0
        private void OnLookupAdd(EntityUid uid, EntityLookupComponent component, ComponentAdd args)
        {
            int capacity;

            if (EntityManager.TryGetComponent(uid, out TransformComponent? xform))
            {
                capacity = (int)Math.Min(256, Math.Ceiling(xform.ChildCount / (float)GrowthRate) * GrowthRate);
            }
            else
            {
                capacity = 256;
            }

            component.Tree = new DynamicTree <EntityUid>(
                GetTreeAABB,
                capacity: capacity,
                growthFunc: x => x == GrowthRate ? GrowthRate * 8 : x * 2
                );
        }
Пример #5
0
 private void OnComponentAdd(EntityUid uid, CharacterInfoComponent component, ComponentAdd args)
 {
     component.Scene = component.Control = new CharacterInfoComponent.CharacterInfoControl();
 }
Пример #6
0
 public Inspector(Rect inspectorRect)
 {
     this.inspectorRect = inspectorRect;
     this.componentAdd  = new ComponentAdd(this);
 }