-
Notifications
You must be signed in to change notification settings - Fork 0
/
KFBotChatManager.uc
96 lines (81 loc) · 6.31 KB
/
KFBotChatManager.uc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
Class KFBotChatManager extends BroadcastHandler;
function PostBeginPlay()
{
NextBroadcastHandler = Level.Game.BroadcastHandler;
Level.Game.BroadcastHandler = Self;
}
final function ProcessCommand( string CallSgn, PlayerController Sender, byte OrderID )
{
local bool bAll;
local int L;
local Controller C;
if( Sender.PlayerReplicationInfo==None || Sender.PlayerReplicationInfo.bOnlySpectator ) // Spectators can't give orders.
return;
if( OrderID==2 && (Sender.Pawn==None || Sender.Pawn.Health<=0) ) // Can't give hold position order while player is dead.
return;
bAll = (CallSgn~="ALL");
L = Len(CallSgn);
for( C=Level.ControllerList; C!=None; C=C.nextController )
{
if( C.bIsPlayer && C.Class==Class'KFInvBots' && (bAll || Left(C.PlayerReplicationInfo.PlayerName,L)~=CallSgn || C.PlayerReplicationInfo.GetCallSign()~=CallSgn) )
{
KFInvBots(C).OrderBot(Sender,OrderID);
if( !bAll )
break;
}
}
}
function UpdateSentText()
{
NextBroadcastHandler.UpdateSentText();
}
function bool AllowsBroadcast( actor broadcaster, int Len )
{
return NextBroadcastHandler.AllowsBroadcast(broadcaster,Len);
}
function BroadcastText( PlayerReplicationInfo SenderPRI, PlayerController Receiver, coerce string Msg, optional name Type )
{
NextBroadcastHandler.BroadcastText( SenderPRI, Receiver, Msg, Type );
}
function BroadcastLocalized( Actor Sender, PlayerController Receiver, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
{
NextBroadcastHandler.BroadcastLocalized( Sender, Receiver, Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
}
function Broadcast( Actor Sender, coerce string Msg, optional name Type )
{
if( Type=='Say' && PlayerController(Sender)!=None )
{
if( Left(Msg,6)~="follow" )
ProcessCommand(Mid(Msg,6),PlayerController(Sender),1);
else if( Left(Msg,4)~="hold" )
ProcessCommand(Mid(Msg,4),PlayerController(Sender),2);
else if( Left(Msg,4)~="free" )
ProcessCommand(Mid(Msg,4),PlayerController(Sender),3);
}
NextBroadcastHandler.Broadcast(Sender,Msg,Type);
}
function BroadcastTeam( Controller Sender, coerce string Msg, optional name Type )
{
if( Type=='Say' && PlayerController(Sender)!=None )
{
if( Left(Msg,6)~="follow" )
ProcessCommand(Mid(Msg,6),PlayerController(Sender),1);
else if( Left(Msg,4)~="hold" )
ProcessCommand(Mid(Msg,4),PlayerController(Sender),2);
else if( Left(Msg,4)~="free" )
ProcessCommand(Mid(Msg,4),PlayerController(Sender),3);
}
NextBroadcastHandler.BroadcastTeam(Sender,Msg,Type);
}
function AllowBroadcastLocalized( actor Sender, class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
{
NextBroadcastHandler.AllowBroadcastLocalized(Sender,Message,Switch,RelatedPRI_1,RelatedPRI_2,OptionalObject);
}
function RegisterBroadcastHandler(BroadcastHandler NewBH)
{
NextBroadcastHandler.RegisterBroadcastHandler(NewBH);
}
function Destroyed();
defaultproperties
{
}