Ejemplo n.º 1
0
        public override void OnNetOwnerChangeEvent(IEntity targetEntity, IPlayer oldPlayer, IPlayer newPlayer)
        {
            base.OnNetOwnerChangeEvent(targetEntity, oldPlayer, newPlayer);
            if (!NetOwnerChangeAsyncEventHandler.HasEvents())
            {
                return;
            }
            var targetEntityRef = new BaseObjectRef(targetEntity);
            var oldPlayerRef    = new BaseObjectRef(oldPlayer);
            var newPlayerRef    = new BaseObjectRef(newPlayer);

            Task.Run(async() =>
            {
                targetEntityRef.DebugCountUp();
                oldPlayerRef.DebugCountUp();
                newPlayerRef.DebugCountUp();
                await NetOwnerChangeAsyncEventHandler.CallAsync(@delegate =>
                                                                @delegate(targetEntity, oldPlayer, newPlayer));
                newPlayerRef.DebugCountDown();
                oldPlayerRef.DebugCountDown();
                targetEntityRef.DebugCountDown();
                newPlayerRef.Dispose();
                oldPlayerRef.Dispose();
                targetEntityRef.Dispose();
            });
        }
Ejemplo n.º 2
0
        public override void OnPlayerDamageEvent(IPlayer player, IEntity entity, uint weapon, ushort damage)
        {
            base.OnPlayerDamageEvent(player, entity, weapon, damage);
            if (!PlayerDamageAsyncEventHandler.HasEvents())
            {
                return;
            }
            var oldHealth       = player.Health;
            var oldArmor        = player.Armor;
            var oldMaxHealth    = player.MaxHealth;
            var oldMaxArmor     = player.MaxArmor;
            var playerReference = new PlayerRef(player);
            var entityReference = new BaseObjectRef(entity);

            Task.Run(async() =>
            {
                playerReference.DebugCountUp();
                entityReference.DebugCountUp();
                await PlayerDamageAsyncEventHandler.CallAsync(@delegate =>
                                                              @delegate(player, entity, oldHealth, oldArmor, oldMaxHealth, oldMaxArmor, weapon, damage));
                entityReference.DebugCountDown();
                playerReference.DebugCountDown();
                playerReference.Dispose();
                entityReference.Dispose();
            });
        }
Ejemplo n.º 3
0
        public override void OnSyncedMetaDataChangeEvent(IEntity entity, string key, object value)
        {
            base.OnSyncedMetaDataChangeEvent(entity, key, value);
            if (!SyncedMetaDataChangeAsyncDelegateHandlers.HasEvents())
            {
                return;
            }
            var baseObjectRef = new BaseObjectRef(entity);

            Task.Run(async() =>
            {
                baseObjectRef.DebugCountUp();
                await SyncedMetaDataChangeAsyncDelegateHandlers.CallAsync(@delegate =>
                                                                          @delegate(entity, key, value));
                baseObjectRef.DebugCountDown();
                baseObjectRef.Dispose();
            });
        }
Ejemplo n.º 4
0
        public override void OnCheckPointEvent(ICheckpoint checkpoint, IEntity entity, bool state)
        {
            base.OnCheckPointEvent(checkpoint, entity, state);
            if (!CheckpointAsyncEventHandler.HasEvents())
            {
                return;
            }
            var checkpointReference = new CheckpointRef(checkpoint);
            var entityReference     = new BaseObjectRef(entity);

            Task.Run(async() =>
            {
                checkpointReference.DebugCountUp();
                entityReference.DebugCountUp();
                await CheckpointAsyncEventHandler.CallAsync(@delegate => @delegate(checkpoint, entity, state));
                entityReference.DebugCountDown();
                checkpointReference.DebugCountDown();
                entityReference.Dispose();
                checkpointReference.Dispose();
            });
        }
Ejemplo n.º 5
0
        public override void OnVehicleDetachEvent(IVehicle targetVehicle, IVehicle detachedVehicle)
        {
            base.OnVehicleDetachEvent(targetVehicle, detachedVehicle);
            if (!VehicleDetachAsyncEventHandler.HasEvents())
            {
                return;
            }
            var targetVehicleRef   = new BaseObjectRef(targetVehicle);
            var detachedVehicleRef = new BaseObjectRef(detachedVehicle);

            Task.Run(async() =>
            {
                targetVehicleRef.DebugCountUp();
                detachedVehicleRef.DebugCountUp();
                await VehicleDetachAsyncEventHandler.CallAsync(@delegate =>
                                                               @delegate(targetVehicle, detachedVehicle));
                targetVehicleRef.DebugCountDown();
                detachedVehicleRef.DebugCountDown();
                detachedVehicleRef.Dispose();
                targetVehicleRef.Dispose();
            });
        }
Ejemplo n.º 6
0
        public override void OnColShapeEvent(IColShape colShape, IEntity entity, bool state)
        {
            base.OnColShapeEvent(colShape, entity, state);
            if (!ColShapeAsyncDelegateHandlers.HasEvents())
            {
                return;
            }
            var colShapeReference = new ColShapeRef(colShape);
            var baseObjectRef     = new BaseObjectRef(entity);

            Task.Run(async() =>
            {
                colShapeReference.DebugCountUp();
                baseObjectRef.DebugCountUp();
                await ColShapeAsyncDelegateHandlers.CallAsync(@delegate =>
                                                              @delegate(colShape, entity, state));
                baseObjectRef.DebugCountDown();
                colShapeReference.DebugCountDown();
                baseObjectRef.Dispose();
                colShapeReference.Dispose();
            });
        }
Ejemplo n.º 7
0
        public override void OnPlayerDeathEvent(IPlayer player, IEntity killer, uint weapon)
        {
            base.OnPlayerDeathEvent(player, killer, weapon);
            if (!PlayerDeadAsyncEventHandler.HasEvents())
            {
                return;
            }
            var playerReference = new PlayerRef(player);
            var killerReference = new BaseObjectRef(killer);

            Task.Run(async() =>
            {
                playerReference.DebugCountUp();
                killerReference.DebugCountUp();
                await PlayerDeadAsyncEventHandler.CallAsync(@delegate =>
                                                            @delegate(player, killer, weapon));
                killerReference.DebugCountDown();
                playerReference.DebugCountDown();
                playerReference.Dispose();
                killerReference.Dispose();
            });
        }
Ejemplo n.º 8
0
        public override void OnWeaponDamageEvent(IntPtr eventPointer, IPlayer sourcePlayer, IEntity targetEntity,
                                                 uint weapon, ushort damage,
                                                 Position shotOffset, BodyPart bodyPart)
        {
            base.OnWeaponDamageEvent(eventPointer, sourcePlayer, targetEntity, weapon, damage, shotOffset, bodyPart);
            if (!WeaponDamageAsyncEventHandler.HasEvents())
            {
                return;
            }
            var sourceReference = new PlayerRef(sourcePlayer);
            var targetReference = new BaseObjectRef(targetEntity);

            Task.Run(async() =>
            {
                sourceReference.DebugCountUp();
                targetReference.DebugCountUp();
                await WeaponDamageAsyncEventHandler.CallAsync(@delegate =>
                                                              @delegate(sourcePlayer, targetEntity, weapon, damage, shotOffset, bodyPart));
                sourceReference.DebugCountDown();
                targetReference.DebugCountDown();
                sourceReference.Dispose();
                targetReference.Dispose();
            });
        }
Ejemplo n.º 9
0
        public override void OnExplosionEvent(IntPtr eventPointer, IPlayer sourcePlayer, ExplosionType explosionType,
                                              Position position,
                                              uint explosionFx, IEntity targetEntity)
        {
            base.OnExplosionEvent(eventPointer, sourcePlayer, explosionType, position, explosionFx, targetEntity);
            if (!ExplosionAsyncEventHandler.HasEvents())
            {
                return;
            }
            var sourceReference       = new PlayerRef(sourcePlayer);
            var targetEntityReference = new BaseObjectRef(targetEntity);

            Task.Run(async() =>
            {
                sourceReference.DebugCountUp();
                targetEntityReference.DebugCountUp();
                await ExplosionAsyncEventHandler.CallAsync(@delegate =>
                                                           @delegate(sourcePlayer, explosionType, position, explosionFx, targetEntity));
                sourceReference.DebugCountDown();
                targetEntityReference.DebugCountDown();
                sourceReference.Dispose();
                targetEntityReference.Dispose();
            });
        }