class NiceSyringe extends NiceMeleeWeapon;

var () int HealBoostAmount;
var float RegenTimer;
var localized   string  SuccessfulHealMessage;

replication
{
    reliable if( Role == ROLE_Authority )
        ClientSuccessfulHeal;

}

simulated function PostBeginPlay()
{
    // Weapon will handle FireMode instantiation
    Super.PostBeginPlay();

    if( Role == ROLE_Authority ) {
       HealBoostAmount = default.HealBoostAmount;
    }
}

// The server lets the client know they successfully healed someone
simulated function ClientSuccessfulHeal(String HealedName)
{
    if( PlayerController(Instigator.Controller) != none )
    {
        PlayerController(Instigator.controller).ClientMessage(SuccessfulHealMessage$HealedName, 'CriticalEvent');
    }
}

simulated function Timer()
{
    Super.Timer();
    if( KFPawn(Instigator)!=None && KFPawn(Instigator).bIsQuickHealing>0 && ClientState==WS_ReadyToFire )
    {
        if( KFPawn(Instigator).bIsQuickHealing==1 )
        {
            if( !HackClientStartFire() )
            {
                if( Instigator.Health>=Instigator.HealthMax || ChargeBar()<0.75 )
                    KFPawn(Instigator).bIsQuickHealing = 2; // Was healed by someone else or some other error occurred.
                SetTimer(0.2,False);
                return;
            }
            KFPawn(Instigator).bIsQuickHealing = 2;
            SetTimer(FireMode[1].FireRate+0.5,False);
        }
        else
        {
            Instigator.SwitchToLastWeapon();
            KFPawn(Instigator).bIsQuickHealing = 0;
        }
    }
    else if( ClientState==WS_Hidden && KFPawn(Instigator)!=None )
        KFPawn(Instigator).bIsQuickHealing = 0; // Weapon was changed, ensure to reset this.
}

simulated function bool HackClientStartFire()
{
    if( StartFire(1) )
    {
        if( Role<ROLE_Authority )
            ServerStartFire(1);
        FireMode[1].ModeDoFire(); // Force to start animating.
        return true;
    }
    return false;
}

defaultproperties
{
    MagCapacity=1
    bChangeClipIcon=True
    hudClipTexture=Texture'KillingFloorHUD.HUD.Hud_Syringe'
    BloodSkinSwitchArray=0
    HealBoostAmount = 100
    TraderInfoTexture=Texture'KillingFloorHUD.WeaponSelect.Syringe'
    FireModeClass(0)=Class'NicePack.NiceSyringeFire'
    FireModeClass(1)=Class'NicePack.NiceSyringeAltFire'
    PickupClass=Class'NicePack.NiceSyringePickup'
    bKFNeverThrow = false
    Skins(0)=Combiner'KF_Weapons_Trip_T.equipment.medInjector_cmb'
    weaponRange=90.000000
    Weight=0.000000
    AIRating=-2.000000
    bMeleeWeapon=False
    Priority=6
    InventoryGroup=5
    GroupOffset=2
    BobDamping=8.000000
    AttachmentClass=Class'KFMod.SyringeAttachment'
    IconCoords=(X1=169,Y1=39,X2=241,Y2=77)
    ItemName="Med-Syringe"
    Mesh=SkeletalMesh'KF_Weapons_Trip.Syringe_Trip'
    AmbientGlow=2
    AmmoCharge(0)=500

    DisplayFOV=85.000000
    StandardDisplayFOV=85.0

    HudImage=texture'KillingFloorHUD.WeaponSelect.Syring_unselected'
    SelectedHudImage=texture'KillingFloorHUD.WeaponSelect.Syringe'

    bConsumesPhysicalAmmo=true
    SuccessfulHealMessage="You healed "
}
