Example #1
0
        public override bool SharedOnFire(ICharacter character, WeaponState weaponState)
        {
            if (IsClient)
            {
                var targetPosition = WeaponGrenadeLauncherHelper.ClientGetCustomTargetPosition();
                weaponState.CustomTargetPosition = targetPosition;
                this.CallServer(
                    _ => _.ServerRemote_ShootOnce(targetPosition));
            }

            return(base.SharedOnFire(character, weaponState));
        }
Example #2
0
        public override void ClientOnFireModChanged(bool isFiring, uint shotsDone)
        {
            var character   = ClientCurrentCharacterHelper.Character;
            var weaponState = ClientCurrentCharacterHelper.PrivateState.WeaponState;

            if (isFiring &&
                !weaponState.ProtoWeapon.SharedCanFire(character, weaponState))
            {
                // cannot fire now
                weaponState.SharedSetInputIsFiring(false);
                return;
            }

            if (!isFiring)
            {
                weaponState.CustomTargetPosition = null;
                return;
            }

            var targetPosition = WeaponGrenadeLauncherHelper.ClientGetCustomTargetPosition();

            weaponState.CustomTargetPosition = targetPosition;
        }