Esempio n. 1
0
        public void fireRez(Sansar.Vector position, Sansar.Vector fwd, Sansar.Quaternion orientation)
        {
            Sansar.Vector rezPosition;
            if (Sound_To_Play != null)
            {
                ScenePrivate.PlaySoundAtPosition(Sound_To_Play, position, PlaySettings.PlayOnce);
            }
            for (int i = 0; i < numberOfRez; i++)
            {
                //so i starts at 0, and will eventually be spacing away, if we add .5 that means .5 of fwd which means if the object is centered
                //it will come right out of our av, .6 is 10% more so we dont hit ourself
                rezPosition = position + offset +
                              (
                    fwd * (spacing * (i + .6f))
                              );

                ScenePrivate.CreateCluster(
                    Bullet_Object,
                    rezPosition,
                    orientation,
                    Sansar.Vector.Zero,
                    CreateClusterHandler
                    );
                Wait(TimeSpan.FromSeconds(.1));
            }
        }
Esempio n. 2
0
        public override void Init()
        {
            Script.UnhandledException += (object o, Exception e) => { if (DebugSpam)
                                                                      {
                                                                          Log.Write("UnhandledException", "[" + (o?.ToString() ?? "NULL") + "] " + e.ToString());
                                                                      }
            };

            SoundSettings.Loudness = LoudnessPercentToDb(LoudnessPct);
            Admins.AddRange(AdminHandles.Trim().ToLower().Split(new char[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries));
            Admins.Add(ScenePrivate.SceneInfo.AvatarId);
            OriginalOrientation = ObjectPrivate.InitialRotation;
            OriginalPosition    = ObjectPrivate.InitialPosition;

            if (ObjectPrivate.TryGetFirstComponent(out RigidBody))
            {
                if (!RigidBody.GetCanGrab())
                {
                    RigidBody.SetCanGrab(true, (data) => { if (!data.Success)
                                                           {
                                                               Log.Write("Could not set ModHammer to grabbable - won't be able to pick up the gun.");
                                                           }
                                         });
                }
                RigidBody.SubscribeToHeldObject(HeldObjectEventType.Grab, OnPickup);
                RigidBody.SubscribeToHeldObject(HeldObjectEventType.Release, OnDrop);
            }

            ScenePrivate.User.Subscribe("AddUser", AddUser);

            if (BanDuration > 0)
            {
                Timer.Create(TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1), CleanupBans);
            }
        }