예제 #1
0
 private void OnStartupEvent(EntityUid uid, NodeContainerComponent component, ComponentStartup args)
 {
     foreach (var node in component.Nodes.Values)
     {
         _nodeGroupSystem.QueueReflood(node);
     }
 }
예제 #2
0
 private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args)
 {
     if (EntityManager.TryGetComponent(lockComp.Owner, out AppearanceComponent? appearance))
     {
         appearance.SetData(StorageVisuals.CanLock, true);
     }
 }
 private void OnStartup(EntityUid uid, RoguePointingArrowComponent component, ComponentStartup args)
 {
     if (EntityManager.TryGetComponent(uid, out SpriteComponent? sprite))
     {
         sprite.DrawDepth = (int)DrawDepth.Overlays;
     }
 }
예제 #4
0
 private void OnClientStartup(EntityUid uid, ResearchClientComponent component, ComponentStartup args)
 {
     if (Servers.Count > 0)
     {
         RegisterClientServer(component, Servers[0]);
     }
 }
예제 #5
0
 private void OnStartup(EntityUid uid, PAIComponent component, ComponentStartup args)
 {
     if (component.MidiAction != null)
     {
         _actionsSystem.AddAction(uid, component.MidiAction, null);
     }
 }
        private void OnStartup(EntityUid uid, SharedCombatModeComponent component, ComponentStartup args)
        {
            if (component.CombatToggleAction == null &&
                _protoMan.TryIndex(component.CombatToggleActionId, out InstantActionPrototype? toggleProto))
            {
                component.CombatToggleAction = new(toggleProto);
            }

            if (component.CombatToggleAction != null)
            {
                _actionsSystem.AddAction(uid, component.CombatToggleAction, null);
            }

            if (component.DisarmAction == null &&
                component.CanDisarm &&
                _protoMan.TryIndex(component.DisarmActionId, out EntityTargetActionPrototype? disarmProto))
            {
                component.DisarmAction = new(disarmProto);
            }

            if (component.DisarmAction != null && component.CanDisarm)
            {
                _actionsSystem.AddAction(uid, component.DisarmAction, null);
            }
        }
        private void OnStartup(EntityUid uid, DockingComponent component, ComponentStartup args)
        {
            // Use startup so transform already initialized
            if (!EntityManager.GetComponent <TransformComponent>(uid).Anchored)
            {
                return;
            }

            EnableDocking(uid, component);

            // This little gem is for docking deserialization
            if (component.DockedWith != null)
            {
                // They're still initialising so we'll just wait for both to be ready.
                if (MetaData(component.DockedWith.Value).EntityLifeStage < EntityLifeStage.Initialized)
                {
                    return;
                }

                var otherDock = EntityManager.GetComponent <DockingComponent>(component.DockedWith.Value);
                DebugTools.Assert(otherDock.DockedWith != null);

                Dock(component, otherDock);
                DebugTools.Assert(component.Docked && otherDock.Docked);
            }
        }
예제 #8
0
 private void OnClugStartup(EntityUid uid, ClusterGrenadeComponent component, ComponentStartup args)
 {
     if (component.FillPrototype != null)
     {
         component.UnspawnedCount = Math.Max(0, component.MaxGrenades - component.GrenadesContainer.ContainedEntities.Count);
         UpdateAppearance(component);
     }
 }
예제 #9
0
 private void OnStartup(EntityUid uid, PAIComponent component, ComponentStartup args)
 {
     _blocker.UpdateCanMove(uid);
     if (component.MidiAction != null)
     {
         _actionsSystem.AddAction(uid, component.MidiAction, null);
     }
 }
예제 #10
0
        private void OnStartup(EntityUid uid, DeployableBarrierComponent component, ComponentStartup args)
        {
            if (!EntityManager.TryGetComponent(component.Owner, out LockComponent? lockComponent))
            {
                return;
            }

            ToggleBarrierDeploy(component, lockComponent.Locked);
        }
예제 #11
0
        private void OnStartup(EntityUid uid, AtmosPipeColorComponent component, ComponentStartup args)
        {
            if (!ComponentManager.TryGetComponent(uid, out AppearanceComponent? appearance))
            {
                return;
            }

            appearance.SetData(PipeColorVisuals.Color, component.Color);
        }
예제 #12
0
        private void OnStartup(EntityUid uid, CollideOnAnchorComponent component, ComponentStartup args)
        {
            if (!EntityManager.TryGetComponent(uid, out TransformComponent? transformComponent))
            {
                return;
            }

            SetCollide(uid, component, transformComponent.Anchored);
        }
예제 #13
0
    private void OnStartup(EntityUid uid, AdminFrozenComponent component, ComponentStartup args)
    {
        if (TryComp <SharedPullableComponent>(uid, out var pullable))
        {
            _pulling.TryStopPull(pullable);
        }

        UpdateCanMove(uid, component, args);
    }
예제 #14
0
        private void OnStartup(EntityUid uid, DockingComponent component, ComponentStartup args)
        {
            // Use startup so transform already initialized
            if (!EntityManager.GetComponent <TransformComponent>(uid).Anchored)
            {
                return;
            }

            EnableDocking(uid, component);
        }
    private void OnStartup(EntityUid uid, MachineFrameComponent component, ComponentStartup args)
    {
        RegenerateProgress(component);

        if (TryComp <ConstructionComponent>(uid, out var construction))
        {
            // Attempt to set pathfinding to the machine node...
            _construction.SetPathfindingTarget(uid, "machine", construction);
        }
    }
 private void OnStartup(EntityUid uid, PolymorphableComponent component, ComponentStartup args)
 {
     if (component.InnatePolymorphs != null)
     {
         foreach (var morph in component.InnatePolymorphs)
         {
             CreatePolymorphAction(morph, uid);
         }
     }
 }
예제 #17
0
 private void OnComponentStartup(EntityUid uid, ThirstComponent component, ComponentStartup args)
 {
     component.CurrentThirst = _random.Next(
         (int)component.ThirstThresholds[ThirstThreshold.Thirsty] + 10,
         (int)component.ThirstThresholds[ThirstThreshold.Okay] - 1);
     component.CurrentThirstThreshold = GetThirstThreshold(component, component.CurrentThirst);
     component.LastThirstThreshold    = ThirstThreshold.Okay; // TODO: Potentially change this -> Used Okay because no effects.
     // TODO: Check all thresholds make sense and throw if they don't.
     UpdateEffects(component);
 }
        private void OnCanisterStartup(EntityUid uid, GasCanisterComponent canister, ComponentStartup args)
        {
            // Ensure container manager.
            var containerManager = EntityManager.EnsureComponent <ContainerManagerComponent>(uid);

            // Ensure container.
            if (!containerManager.TryGetContainer(canister.ContainerName, out _))
            {
                containerManager.MakeContainer <ContainerSlot>(canister.ContainerName);
            }
        }
        private void OnStackStarted(EntityUid uid, SharedStackComponent component, ComponentStartup args)
        {
            if (!TryComp(uid, out AppearanceComponent? appearance))
            {
                return;
            }

            appearance.SetData(StackVisuals.Actual, component.Count);
            appearance.SetData(StackVisuals.MaxCount, component.MaxCount);
            appearance.SetData(StackVisuals.Hide, false);
        }
예제 #20
0
        private void OnStartup(EntityUid uid, LoadoutComponent component, ComponentStartup args)
        {
            if (component.Prototype == string.Empty)
            {
                return;
            }

            var proto = _protoMan.Index <StartingGearPrototype>(component.Prototype);

            _station.EquipStartingGear(uid, proto, null);
        }
예제 #21
0
        private void OnStartup(EntityUid uid, JitteringComponent jittering, ComponentStartup args)
        {
            if (!EntityManager.TryGetComponent(uid, out ISpriteComponent? sprite))
            {
                return;
            }

            var animationPlayer = EntityManager.EnsureComponent <AnimationPlayerComponent>(uid);

            animationPlayer.Play(GetAnimation(jittering, sprite), _jitterAnimationKey);
        }
    private void OnHeadstandAdded(EntityUid uid, HeadstandComponent component, ComponentStartup args)
    {
        if (!TryComp <SpriteComponent>(uid, out var sprite))
        {
            return;
        }

        foreach (var layer in sprite.AllLayers)
        {
            layer.Rotation += Angle.FromDegrees(180.0f);
        }
    }
    private void OnGetActions(EntityUid uid, IntrinsicUIComponent component, ComponentStartup args)
    {
        if (!TryComp <ActionsComponent>(uid, out var actions))
        {
            return;
        }

        foreach (var entry in component.UIs)
        {
            _actionsSystem.AddAction(uid, entry.ToggleAction, null, actions);
        }
    }
    private void OnVehicleStartup(EntityUid uid, VehicleComponent component, ComponentStartup args)
    {
        UpdateDrawDepth(uid, 2);

        // This code should be purged anyway but with that being said this doesn't handle components being changed.
        if (TryComp <SharedStrapComponent>(uid, out var strap))
        {
            component.BaseBuckleOffset  = strap.BuckleOffset;
            strap.BuckleOffsetUnclamped = Vector2.Zero;
        }

        _modifier.RefreshMovementSpeedModifiers(uid);
    }
 private void OnMobStartup(EntityUid uid, MobStateComponent component, ComponentStartup args)
 {
     if (component.CurrentState != null && component.CurrentThreshold != null)
     {
         // Initialize with given states
         SetMobState(component, null, (component.CurrentState.Value, component.CurrentThreshold.Value));
     }
     else
     {
         // Initialize with some amount of damage, defaulting to 0.
         UpdateState(component, CompOrNull <DamageableComponent>(uid)?.TotalDamage ?? FixedPoint2.Zero);
     }
 }
예제 #26
0
    private void OnStartup(EntityUid uid, VocalComponent component, ComponentStartup args)
    {
        if (component.ScreamAction == null &&
            _proto.TryIndex(component.ActionId, out InstantActionPrototype? act))
        {
            component.ScreamAction = new(act);
        }

        if (component.ScreamAction != null)
        {
            _actions.AddAction(uid, component.ScreamAction, null);
        }
    }
예제 #27
0
        private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
        {
            // Allow this entity to be seen by other ghosts.
            var visibility = component.Owner.EnsureComponent <VisibilityComponent>();

            visibility.Layer |= (int)VisibilityFlags.Ghost;
            visibility.Layer &= ~(int)VisibilityFlags.Normal;

            if (component.Owner.TryGetComponent(out EyeComponent? eye))
            {
                eye.VisibilityMask |= (uint)VisibilityFlags.Ghost;
            }

            component.TimeOfDeath = _gameTiming.RealTime;
        }
예제 #28
0
    private void FliesAdded(EntityUid uid, FliesComponent component, ComponentStartup args)
    {
        if (!TryComp <SpriteComponent>(uid, out var sprite))
        {
            return;
        }

        if (sprite.LayerMapTryGet(FliesKey.Key, out var _))
        {
            return;
        }

        var layer = sprite.AddLayer(new SpriteSpecifier.Rsi(new ResourcePath("Objects/Misc/flies.rsi"), "flies"));

        sprite.LayerMapSet(FliesKey.Key, layer);
    }
예제 #29
0
        private void OnGhostStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
        {
            // Allow this entity to be seen by other ghosts.
            var visibility = EntityManager.EnsureComponent <VisibilityComponent>(component.Owner);

            _visibilitySystem.AddLayer(visibility, (int)VisibilityFlags.Ghost, false);
            _visibilitySystem.RemoveLayer(visibility, (int)VisibilityFlags.Normal, false);
            _visibilitySystem.RefreshVisibility(visibility);

            if (EntityManager.TryGetComponent(component.Owner, out EyeComponent? eye))
            {
                eye.VisibilityMask |= (uint)VisibilityFlags.Ghost;
            }

            component.TimeOfDeath = _gameTiming.RealTime;
        }
예제 #30
0
        private void OnShuttleStartup(EntityUid uid, ShuttleComponent component, ComponentStartup args)
        {
            if (!EntityManager.HasComponent <IMapGridComponent>(component.Owner))
            {
                return;
            }

            if (!EntityManager.TryGetComponent(component.Owner, out PhysicsComponent? physicsComponent))
            {
                return;
            }

            if (component.Enabled)
            {
                Enable(physicsComponent);
            }
        }