Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DancePlayerMut extends Mutator;
- const NUM_EMOJI_ANIMS = 53;
- var PlayerController PC;
- var transient Interaction ClientInteraction;
- var const name EMAnims[53];
- var const string EMAbbrevs[53];
- var string interaction${1}< ${3} >
- function PostBeginPlay()
- {
- local KFGameType KFGT;
- KFGT = KFGameType(Level.Game);
- if(KFGT == none)
- return;
- KFGT.PlayerControllerClass = class'DancePlayerController';
- KFGT.PlayerControllerClassName = string(class'DancePlayerController');
- }
- simulated function Tick(float DeltaTime)
- {
- // local PlayerController PC;
- PC = Level.GetLocalPlayerController();
- if(Role == ROLE_Authority)
- Disable('Tick');
- // else if(Role == ROLE_SimulatedProxy && KFPlayerReplicationInfo(PC.PlayerReplicationInfo) != none)
- // {
- if(/* Role == ROLE_SimulatedProxy && */ PC != none)
- {
- PC.Player.InteractionMaster.AddInteraction(interactionClass, PC.Player);
- DancePlayerInteraction(ClientInteraction).mut = self;
- }
- Disable('Tick');
- // }
- }
- /* simulated function PostNetBeginPlay()
- // simulated function PostBeginPlay()
- {
- PC = Level.GetLocalPlayerController();
- if(PC != none)
- {
- ClientInteraction = PC.Player.InteractionMaster.AddInteraction(interactionClass, PC.Player);
- DancePlayerInteraction(ClientInteraction).mut = self;
- }
- super.PostBeginPlay();
- } */
- function PlayerController FindPlayer(int id)
- {
- local PlayerController Player;
- local Controller C;
- for(C = Level.ControllerList;C != none;C = C.nextController)
- {
- Player = PlayerController(C);
- if(Player != none && Player.PlayerReplicationInfo.PlayerID == id)
- return Player;
- }
- return none;
- }
- function string MergeStrings(array<string> Input, int StartPosition)
- {
- local int i;
- local string Result;
- if(StartPosition >= Input.Length)
- return "";
- Result = Input[StartPosition];
- if(StartPosition < Input.Length - 1)
- {
- for(i = StartPosition + 1;i < Input.Length;i++)
- Result @= Input[i];
- }
- return Result;
- }
- function Mutate(string MutateString, PlayerController Sender)
- {
- local Controller C;
- local PlayerController Target;
- local array<string> Commands;
- local string TempString;
- local int i;
- if(Sender.PlayerReplicationInfo.bAdmin || Sender.PlayerReplicationInfo.bSilentAdmin || Level.NetMode == NM_Standalone || Level.NetMode == NM_ListenServer)
- {
- Split(MutateString, " ", Commands);
- if(Commands[0] ~= "x")
- {
- if(Commands.Length == 1)
- SendMessage(Sender, "Use %gmutate x inf %wto get the list of %rconsole commands%w.");
- else if(Commands[1] ~= "INF")
- {
- SendMessage(Sender, "=%g=%r=%w=%g=%r= %gList of commands %r=%g=%w=%r=%g=%w=");
- SendMessage(Sender, " ");
- SendMessage(Sender, "%gClientCommand%w, %gCC %r<target> <string>%w: force %r<target> %wto use command %r<string>%w.");
- SendMessage(Sender, "%gClientEmoji%w, %gCE, %gD %r<target> <string>%w: force %r<target> %wto emote.");
- SendMessage(Sender, "Use %gmutate x inf list %wto get the list of %rdances%w.");
- if(Commands[2] ~= "List")
- {
- SendMessage(Sender, " ");
- SendMessage(Sender, "List of dances: ");
- for(i=0;i < 53;i++)
- {
- SendMessage(Sender, "%w" $ string(i) $ " %r- %g" $ string(EMAnims[i]));
- }
- }
- }
- else if(Commands[1] ~= "ClientCommand" || Commands[1] ~= "CC")
- {
- if(Commands.Length == 2)
- Commands[Commands.Length] = "0";
- if(Commands.Length == 3)
- Commands[Commands.Length] = "Say :yoba:";
- Target = FindPlayer(Max(int(Commands[2]), 0));
- if(DancePlayerController(Target) != none)
- {
- TempString = MergeStrings(Commands, 3);
- DancePlayerController(Target).PerformCommand(TempString);
- SendMessage(Sender, "%g" $ Target.PlayerReplicationInfo.PlayerName $ " %wused %r" $ TempString);
- }
- else
- SendMessage(Sender, "%gThe player %wdoesn't %rexist%w!");
- }
- else if(Commands[1] ~= "ClientEmoji" || Commands[1] ~= "CE" || Commands[1] ~= "D")
- {
- if(Commands.Length == 2)
- Commands[Commands.Length] = "Me";
- if(Commands.Length == 3)
- Commands[Commands.Length] = "0";
- if(Commands[2] ~= "All" || Commands[2] ~= "A")
- {
- if(AlivePlayers() > 0)
- {
- for(C = Level.ControllerList;C != none;C = C.nextController)
- {
- if((PlayerController(C) != none) && DanceHumanPawn(C.Pawn) != none)
- DanceHumanPawn(C.Pawn).EmojiTrigger(EMAnims[Clamp(int(Commands[3]), 0, 52)]);
- }
- if(!Sender.PlayerReplicationInfo.bSilentAdmin)
- BroadcastText(("%g" $ Sender.PlayerReplicationInfo.PlayerName) $ " %wforced %rall the players %wto emote.");
- else
- SendMessage(Sender, "%gYou %whave forced %rall the players %wto emote.");
- }
- else
- SendMessage(Sender, "%gNo players %ralive%w!");
- }
- else if(Commands[2] ~= "Me" || Commands[2] ~= "M")
- {
- if(DanceHumanPawn(Sender.Pawn) != none)
- DanceHumanPawn(Sender.Pawn).EmojiTrigger(EMAnims[Clamp(int(Commands[3]), 0, 52)]);
- else
- SendMessage(Sender, "%gYou %ware %rdead %wor %ra spectator%w!");
- }
- else
- {
- Target = FindPlayer(Max(int(Commands[2]), 2));
- if(Target != none && DanceHumanPawn(Target.Pawn) != none)
- {
- DanceHumanPawn(Target.Pawn).EmojiTrigger(EMAnims[Clamp(int(Commands[3]), 0, 52)]);
- if(!Sender.PlayerReplicationInfo.bSilentAdmin)
- BroadcastText("%g" $ Sender.PlayerReplicationInfo.PlayerName $ " %wforced %r" $ Target.PlayerReplicationInfo.PlayerName $ " %wto emote.");
- else
- SendMessage(Sender, "%gYou %whave forced %r" $ Target.PlayerReplicationInfo.PlayerName $ " %wto emote.");
- }
- else
- SendMessage(Sender, "%gThe player %wdoesn't %rexist%w, %whe is %ra spectator %wor %rdead%w!");
- }
- }
- }
- }
- else
- {
- Split(MutateString, " ", Commands);
- if(Commands[0] ~= "x")
- {
- if(Commands.Length == 1)
- SendMessage(Sender, "Use %gmutate x inf %wto get the list of %rconsole commands%w.");
- else if(Commands[1] ~= "INF")
- {
- SendMessage(Sender, "=%g=%r=%w=%g=%r= %gList of commands %r=%g=%w=%r=%g=%w=");
- SendMessage(Sender, " ");
- SendMessage(Sender, "%gClientEmoji%w, %gCE, %D %r<target> <string>%w: force %r<target> %wto emote.");
- SendMessage(Sender, "Use %gmutate x inf list %wto get the list of %rdances%w.");
- if(Commands[2] ~= "List")
- {
- SendMessage(Sender, " ");
- SendMessage(Sender, "List of dances: ");
- for(i=0;i < 53;i++)
- {
- SendMessage(Sender, "%w" $ string(i) $ " %r- %g" $ string(EMAnims[i]));
- }
- }
- }
- else if(Commands[1] ~= "ClientEmoji" || Commands[1] ~= "CE" || Commands[1] ~= "D")
- {
- if(Commands.Length == 2)
- Commands[Commands.Length] = "Me";
- if(Commands.Length == 3)
- Commands[Commands.Length] = "0";
- if(DanceHumanPawn(Sender.Pawn) != none)
- DanceHumanPawn(Sender.Pawn).EmojiTrigger(EMAnims[Clamp(int(Commands[3]), 0, 52)]);
- else
- SendMessage(Sender, "%gYou %ware %rdead %wor %ra spectator%w!");
- }
- }
- }
- super.Mutate(MutateString, Sender);
- }
- function int AlivePlayers()
- {
- local Controller C;
- local int Counter;
- for(C = Level.ControllerList;C != none;C = C.nextController)
- {
- if(PlayerController(C) != none && C.Pawn != none && C.Pawn.Health > 0)
- Counter ++;
- }
- return Counter;
- }
- function SendMessage(PlayerController Player, coerce string Message)
- {
- if(Player == none || Message == "")
- return;
- if(Player.PlayerReplicationInfo.PlayerName ~= "WebAdmin" && Player.PlayerReplicationInfo.PlayerID == 0)
- Message = StripFormattedString(Message);
- else
- Message = ParseFormattedLine(Message);
- Player.TeamMessage(none, Message, 'DancePlayer');
- }
- function BroadcastText(string Message, optional bool bSaveToLog)
- {
- local Controller C;
- for(C = Level.ControllerList;C != none;C = C.nextController)
- {
- if(PlayerController(C) != none)
- SendMessage(PlayerController(C), Message);
- }
- if(bSaveToLog)
- Message = StripFormattedString(Message);
- // Log("DancePlayer: " $ Message);
- }
- function string ParseFormattedLine(string Input)
- {
- ReplaceText(Input, "%r", ((Chr(27) $ Chr(200)) $ Chr(1)) $ Chr(1));
- ReplaceText(Input, "%g", ((Chr(27) $ Chr(1)) $ Chr(200)) $ Chr(1));
- ReplaceText(Input, "%b", ((Chr(27) $ Chr(1)) $ Chr(100)) $ Chr(200));
- ReplaceText(Input, "%w", ((Chr(27) $ Chr(200)) $ Chr(200)) $ Chr(200));
- ReplaceText(Input, "%y", ((Chr(27) $ Chr(200)) $ Chr(200)) $ Chr(1));
- ReplaceText(Input, "%p", ((Chr(27) $ Chr(200)) $ Chr(1)) $ Chr(200));
- return Input;
- }
- function string StripFormattedString(string Input)
- {
- ReplaceText(Input, "%r", "");
- ReplaceText(Input, "%g", "");
- ReplaceText(Input, "%b", "");
- ReplaceText(Input, "%w", "");
- ReplaceText(Input, "%y", "");
- ReplaceText(Input, "%p", "");
- return Input;
- }
- defaultproperties
- {
- EMAnims(0)="Dance_CanCan"
- EMAnims(1)="Dance_Chicken"
- EMAnims(2)="Dance_MaraschinoStep"
- EMAnims(3)="Dance_RunningMan"
- EMAnims(4)="Dance_Twerk"
- EMAnims(5)="Dance_Noodle"
- EMAnims(6)="Dance_Rainbow"
- EMAnims(7)="Dance_Silly"
- EMAnims(8)="Dance_Snake"
- EMAnims(9)="Dance_Tut"
- EMAnims(10)="Dance_Twist"
- EMAnims(11)="Dance_RaiseTheRoof"
- EMAnims(12)="Dance_Quake"
- EMAnims(13)="Dance_RibPops"
- EMAnims(14)="Dance_Macarena"
- EMAnims(15)="Dance_Salsa"
- EMAnims(16)="Dance_Shuffling"
- EMAnims(17)="Dance_YMCA"
- EMAnims(18)="Gesture_Summersault"
- EMAnims(19)="Gesture_Dab"
- EMAnims(20)="Gesture_Agony"
- EMAnims(21)="Gesture_Booty"
- EMAnims(22)="Gesture_Salute"
- EMAnims(23)="Gesture_LookingAround"
- EMAnims(24)="Gesture_Petting"
- EMAnims(25)="Gesture_Patting"
- EMAnims(26)="Gesture_ThroatSlash"
- EMAnims(27)="Gesture_Elbow"
- EMAnims(28)="Gesture_Power"
- EMAnims(29)="Gesture_Victory"
- EMAnims(30)="Gesture_Star"
- EMAnims(31)="Gesture_JoyfulJump"
- EMAnims(32)="Gesture_Waving"
- EMAnims(33)="Gesture_Hello"
- EMAnims(34)="Gesture_Cheering"
- EMAnims(35)="Gesture_Clapping"
- EMAnims(36)="Gesture_Crazy"
- EMAnims(37)="Gesture_Defeated"
- EMAnims(38)="Gesture_HokeyPokey"
- EMAnims(39)="Gesture_No"
- EMAnims(40)="Gesture_Pain"
- EMAnims(41)="Gesture_Pointing"
- EMAnims(42)="Gesture_Shaking"
- EMAnims(43)="Gesture_Strong"
- EMAnims(44)="Gesture_Whatever"
- EMAnims(45)="Fight_ElbowUppercut"
- EMAnims(46)="Fight_HeadButt"
- EMAnims(47)="Fight_Fireball"
- EMAnims(48)="Fight_IllegalElbowPunch"
- EMAnims(49)="Fight_JabToElbowPunch"
- EMAnims(50)="Fight_HighKick"
- EMAnims(51)="Fight_PunchingBag"
- EMAnims(52)="Fight_UppercutJab"
- EMAbbrevs(0)="Can Can"
- EMAbbrevs(1)="Chicken"
- EMAbbrevs(2)="Maraschino Step"
- EMAbbrevs(3)="Running Man"
- EMAbbrevs(4)="Twerk"
- EMAbbrevs(5)="Noodle"
- EMAbbrevs(6)="Rainbow"
- EMAbbrevs(7)="Silly"
- EMAbbrevs(8)="Snake"
- EMAbbrevs(9)="Tut"
- EMAbbrevs(10)="Twist"
- EMAbbrevs(11)="Raise The Roof"
- EMAbbrevs(12)="Quake"
- EMAbbrevs(13)="Rib Pops"
- EMAbbrevs(14)="Macarena"
- EMAbbrevs(15)="Salsa"
- EMAbbrevs(16)="Shuffling"
- EMAbbrevs(17)="YMCA"
- EMAbbrevs(18)="Summersault"
- EMAbbrevs(19)="Dab"
- EMAbbrevs(20)="Agony"
- EMAbbrevs(21)="Booty"
- EMAbbrevs(22)="Salute"
- EMAbbrevs(23)="Looking Around"
- EMAbbrevs(24)="Petting"
- EMAbbrevs(25)="Patting"
- EMAbbrevs(26)="Throat Slash"
- EMAbbrevs(27)="Elbow"
- EMAbbrevs(28)="Power"
- EMAbbrevs(29)="Victory"
- EMAbbrevs(30)="Star"
- EMAbbrevs(31)="Joyful Jump"
- EMAbbrevs(32)="Waving"
- EMAbbrevs(33)="Hello"
- EMAbbrevs(34)="Cheering"
- EMAbbrevs(35)="Clapping"
- EMAbbrevs(36)="Crazy"
- EMAbbrevs(37)="Defeated"
- EMAbbrevs(38)="Hokey Pokey"
- EMAbbrevs(39)="No"
- EMAbbrevs(40)="Pain"
- EMAbbrevs(41)="Pointing"
- EMAbbrevs(42)="Shaking"
- EMAbbrevs(43)="Strong"
- EMAbbrevs(44)="Whatever"
- EMAbbrevs(45)="Elbow Uppercut"
- EMAbbrevs(46)="Head Butt"
- EMAbbrevs(47)="Fireball"
- EMAbbrevs(48)="Illegal Elbow Punch"
- EMAbbrevs(49)="Jab To Elbow Punch"
- EMAbbrevs(50)="High Kick"
- EMAbbrevs(51)="Punching Bag"
- EMAbbrevs(52)="Uppercut Jab"
- bAddToServerPackages=true
- interactionClass="DancePlayer.DancePlayerInteraction"
- GroupName="KFDancePlayer"
- FriendlyName="KFDancePlayer"
- Description="KFDancePlayer"
- bAlwaysRelevant=true
- RemoteRole=ROLE_SimulatedProxy
- }
Add Comment
Please, Sign In to add comment