예제 #1
0
        private void AfterInteractOn(EntityUid uid, AirlockPainterComponent component, AfterInteractEvent args)
        {
            if (component.IsSpraying || args.Target is not {
                Valid: true
            } target || !args.CanReach)
            {
                return;
            }

            if (!EntityManager.TryGetComponent <PaintableAirlockComponent>(target, out var airlock))
            {
                return;
            }

            if (!_prototypeManager.TryIndex <AirlockGroupPrototype>(airlock.Group, out var grp))
            {
                Logger.Error("Group not defined: %s", airlock.Group);
                return;
            }

            string style = Styles[component.Index];

            if (!grp.StylePaths.TryGetValue(style, out var sprite))
            {
                string msg = Loc.GetString("airlock-painter-style-not-available");
                _popupSystem.PopupEntity(msg, args.User, Filter.Entities(args.User));
                return;
            }
            component.IsSpraying = true;
            var doAfterEventArgs = new DoAfterEventArgs(args.User, component.SprayTime, default, target)
예제 #2
0
 private void OnActivate(EntityUid uid, AirlockPainterComponent component, ActivateInWorldEvent args)
 {
     if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
     {
         return;
     }
     DirtyUI(uid, component);
     component.Owner.GetUIOrNull(AirlockPainterUiKey.Key)?.Open(actor.PlayerSession);
     args.Handled = true;
 }