Reload Interrupt Mutator. Mutator interrupt cooldown

Reload Interrupt Mutator. Mutator interrupt cooldown

  • Topic closed
  • You cannot reply to this topic

Reload Interrupt Mutator. Mutator interrupt cooldown Reload Interrupt Mutator. Mutator interrupt cooldown Some guns take a very long and tedious time to reload and do not give you a chance to change to another weapon. This is the simplest mutator that allows you to inte...

Geekrainian #1

    • Group: Admin
    • Posts: 800

    Posted:

    Reload Interrupt Mutator. Mutator interrupt cooldown

    Some guns take a very long and tedious time to reload and do not give you a chance to change to another weapon. This is the simplest mutator that allows you to interrupt any reload by changing weapons or throwing a grenade. In principle, you can add, for example, “Fire” and “AltFire” among the InterruptAliases in the Interaction class. Then you will be able to partially reload and shoot where previously this was not allowed.

    class ReloadInterruptMut extends Mutator;
    //simple version of Reload Options Mutator
    //author: a1eat0r
    //link: http://forums.tripwireinteractive.com/showpost.php?p=1208486&postcount=1
    //каждому игроку вешаем Interaction класс, который будет отслеживать нажатие клавиш
    simulated function Tick(float DeltaTime)
    {
        local PlayerController PC;
        PC = Level.GetLocalPlayerController();
    
        if (PC != None)
        {
            PC.Player.InteractionMaster.AddInteraction("ReloadInterruptMut.RIInteraction", PC.Player);
            Disable('Tick');
        }
    }
    defaultproperties
    {
        GroupName="KF-ReloadInterrupt"
        FriendlyName="ReloadInterruptMut"
        Description="ReloadInterruptMut"
        bAlwaysRelevant=true
        RemoteRole=ROLE_SimulatedProxy
        bAddToServerPackages=true
    }
    class RIInteraction extends Interaction;
    var KFPlayerController PC;
    var array<string> InterruptAliases;
    function Initialize()
    {
        PC = KFPlayerController(ViewportOwner.Actor);
        if (PC == None)
            Master.RemoveInteraction(Self);
        if (InterruptAliases.Length == 0)
            InterruptAliases = default.InterruptAliases;
    }
    event NotifyLevelChange()
    {
        Master.RemoveInteraction(Self);
    }
    function KFWeapon GetWeapon()
    {
        if (PC.Pawn != None)
            return KFWeapon(PC.Pawn.Weapon);
        else
            return None;
    }
    //Получаем текущую пушку в руках у игрока, если она перезаряжается - прерываем процесс
    //на сервере и на клиенте
    function InterruptReload()
    {
        local KFWeapon W;
        W = GetWeapon();
        if (W == None)
            return;
        if(W.bIsReloading)
        {
            W.ServerInterruptReload();
            if    (
                    PC.Level.NetMode != NM_StandAlone
                    &&    (PC.Level.NetMode != NM_ListenServer || !PC.Pawn.IsLocallyControlled())
                )
            {
                W.ClientInterruptReload();
            }
        }
    }
    //Если нажата клавиша - срабатываем и проверяем что нажато. Если действие является одним из //перечисленных в массиве InterruptAliases, то прерываем перезарядку
    function bool KeyEvent(EInputKey Key, EInputAction Action, float Delta)
    {
        local string Alias, LeftPart, RigthPart;
        local int i;
        if (Action == IST_Press)
        {
            Alias = PC.ConsoleCommand("KEYBINDING" @ PC.ConsoleCommand("KEYNAME" @ Key));
            if (Divide(Alias, " ", LeftPart, RigthPart))
                Alias = LeftPart;
            for (i = 0; i < InterruptAliases.Length; i++)
            {
                if (Alias ~= InterruptAliases[i])
                {
                    InterruptReload();
                    break;
                }
            }
        }
        return false;
    }
    defaultproperties
    {
        InterruptAliases(0)="ThrowNade"
        InterruptAliases(1)="ThrowGrenade"
        InterruptAliases(2)="GetWeapon"
        InterruptAliases(3)="SwitchWeapon"
        InterruptAliases(4)="SwitchToLastWeapon"
    }

    Add as ReloadInterruptMut.ReloadInterruptMut Author: Flame

    Back