KF2-Server-Extension/ServerExt/Classes/ExtPlayerInput.uc

97 lines
2.0 KiB
Ucode
Raw Permalink Normal View History

2017-10-20 02:00:49 +00:00
Class ExtPlayerInput extends KFPlayerInput;
var KF2GUIController MyGUIController;
var bool bHandledTravel;
exec function StartCrouch()
{
bDuck = 1;
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
exec function ToggleCrouch()
{
bDuck = (bDuck == 0) ? 1 : 0;
}
simulated exec function IronSights(optional bool bHoldButtonMode)
{
local KFWeapon KFW;
2020-11-28 20:12:58 +00:00
if (Pawn != none)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (KFPawn_Monster(Pawn)!=None)
2017-10-20 02:00:49 +00:00
Pawn.StartFire(1);
else
{
KFW = KFWeapon(Pawn.Weapon);
2020-11-28 20:04:55 +00:00
if (KFW != None)
2017-10-20 02:00:49 +00:00
KFW.SetIronSights((bHoldButtonMode) ? true : !KFW.bUsingSights);
}
}
}
2020-11-28 21:54:57 +00:00
2017-10-20 02:00:49 +00:00
simulated exec function IronSightsRelease(optional bool bHoldButtonMode)
{
local KFWeapon KFW;
2020-11-28 20:12:58 +00:00
if (Pawn != none)
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (KFPawn_Monster(Pawn)!=None)
2017-10-20 02:00:49 +00:00
Pawn.StopFire(1);
else
{
KFW = KFWeapon(Pawn.Weapon);
2020-11-28 20:04:55 +00:00
if (!KFW.bHasIronSights || bHoldButtonMode)
2017-10-20 02:00:49 +00:00
KFW.SetIronSights(false);
}
}
}
simulated exec function ToggleFlashlight()
{
2020-11-28 20:12:58 +00:00
if (KFPawn_Monster(Pawn)!=None && Pawn.Health>0)
2017-10-20 02:00:49 +00:00
SetNightVision(!bNightVisionActive);
else Super.ToggleFlashlight();
}
2020-11-28 20:04:55 +00:00
function PreClientTravel(string PendingURL, ETravelType TravelType, bool bIsSeamlessTravel)
2017-10-20 02:00:49 +00:00
{
Super.PreClientTravel(PendingURL,TravelType,bIsSeamlessTravel);
2020-11-28 20:12:58 +00:00
if (!bHandledTravel)
2017-10-20 02:00:49 +00:00
{
bHandledTravel = true;
2020-11-28 20:12:58 +00:00
if (KFExtendedHUD(MyHUD)!=None)
2017-10-20 02:00:49 +00:00
KFExtendedHUD(MyHUD).NotifyLevelChange(true);
}
}
event bool FilterButtonInput(int ControllerId, Name Key, EInputEvent Event, float AmountDepressed, bool bGamepad)
{
2020-11-28 20:04:55 +00:00
if (MyGfxManager.bAfterLobby && Event==IE_Pressed && (Key == 'Escape' || Key == 'XboxTypeS_Start'))
2017-10-20 02:00:49 +00:00
{
2020-11-28 20:12:58 +00:00
if (MyGUIController==None || MyGUIController.bIsInvalid)
2017-10-20 02:00:49 +00:00
{
MyGUIController = class'KF2GUIController'.Static.GetGUIController(Outer);
2020-11-28 20:12:58 +00:00
if (MyGUIController==None)
2017-10-20 02:00:49 +00:00
{
ExtPlayerController(Outer).CancelConnection();
return false;
}
}
2020-11-28 20:12:58 +00:00
if (MyGUIController.bIsInMenuState)
2017-10-20 02:00:49 +00:00
{
return false;
}
2020-11-28 20:12:58 +00:00
else if (MyGFxManager.bMenusOpen)
2017-10-20 02:00:49 +00:00
{
return MyGFxManager.ToggleMenus();
}
else
{
MyGUIController.OpenMenu(ExtPlayerController(Outer).MidGameMenuClass);
return true;
}
}
return false;
}