diff --git a/plugins/l4d2_feedthetrolls.smx b/plugins/l4d2_feedthetrolls.smx index 1089b87..257cc98 100644 Binary files a/plugins/l4d2_feedthetrolls.smx and b/plugins/l4d2_feedthetrolls.smx differ diff --git a/scripting/include/feedthetrolls/commands.inc b/scripting/include/feedthetrolls/commands.inc index 8ab4cd3..022e694 100644 --- a/scripting/include/feedthetrolls/commands.inc +++ b/scripting/include/feedthetrolls/commands.inc @@ -256,7 +256,7 @@ public Action Command_ApplyUser(int client, int args) { } SilentMenuSelected[client] = false; - SetupCategoryMenu(client, target_list[0]); + SetupCategoryMenu(client, GetClientUserId(target_list[0])); } return Plugin_Handled; } @@ -285,7 +285,7 @@ public Action Command_ApplyComboTrolls(int client, int args) { ReplyToTargetError(client, target_count); return Plugin_Handled; } - ShowTrollCombosMenu(client, target_list[0]); + ShowTrollCombosMenu(client, GetClientUserId(target_list[0])); } return Plugin_Handled; } @@ -329,7 +329,7 @@ public Action Command_ApplyUserSilent(int client, int args) { } ReplyToCommand(client, "[FTT] Unknown category: '%s'", arg2); } - SetupCategoryMenu(client, target_list[0]); + SetupCategoryMenu(client, GetClientUserId(target_list[0])); } return Plugin_Handled; } diff --git a/scripting/include/feedthetrolls/events.inc b/scripting/include/feedthetrolls/events.inc index 1bf8846..05f7f8a 100644 --- a/scripting/include/feedthetrolls/events.inc +++ b/scripting/include/feedthetrolls/events.inc @@ -32,6 +32,17 @@ public void OnClientPutInServer(int client) { SDKHook(client, SDKHook_OnTakeDamage, Event_TakeDamage); SDKHook(client, SDKHook_OnTakeDamageAlive, NerfGun_OnTakeDamage); } +/* Projectile Magnet: + 1. Create watch timer on EntityCreateCallback + 2. Test velocity over time + 3. If velocity goes negative, its at apex: + - TraceRay to victim + - If collision && molotov (maybe acid/): + Get End Position + If Distance From End Position & Victim < 100 units or so + Allow + - If no collision, set angle to player, set velocity accordingly +*/ public void OnEntityCreated(int entity, const char[] classname) { if(entity >= MaxClients) { if(StrEqual(classname, "infected", false)) @@ -351,8 +362,14 @@ bool WillMagnetRun(const Troll troll, int i) { } public Action L4D2_OnEntityShoved(int client, int entity, int weapon, float vecDir[3], bool bIsHighPounce) { - if(client > 0 && client <= MaxClients && IsTrollActive(client, "No Shove") && hShoveFailChance.FloatValue > GetRandomFloat()) { - return Plugin_Handled; + if(client > 0 && client <= MaxClients) { + static int noShoveIndex; + if(noShoveIndex == 0) noShoveIndex == GetTrollID("No Shove"); + if(Trolls[noShoveIndex].IsActive(client) && GetRandomFloat() < hShoveFailChance.FloatValue) { + float shoveTime = L4D2Direct_GetNextShoveTime(client); + L4D2Direct_SetNextShoveTime(client, shoveTime + 2.0); + return Plugin_Handled; + } } return Plugin_Continue; } diff --git a/scripting/include/feedthetrolls/menus.inc b/scripting/include/feedthetrolls/menus.inc index 7452eef..e7fa0db 100644 --- a/scripting/include/feedthetrolls/menus.inc +++ b/scripting/include/feedthetrolls/menus.inc @@ -82,9 +82,9 @@ public int ChoosePlayerHandler(Menu menu, MenuAction action, int param1, int par static char info[8]; menu.GetItem(param2, info, sizeof(info)); int userid = StringToInt(info); - int client = GetClientOfUserId(userid); + int victim = GetClientOfUserId(userid); - if(client == 0) { + if(victim == 0) { ReplyToCommand(param1, "FTT: Could not acquire player"); return 0; } @@ -146,9 +146,9 @@ public int ChooseCategoryHandler(Menu menu, MenuAction action, int param1, int p static char str[2][8]; ExplodeString(info, "|", str, 2, 8, false); int userid = StringToInt(str[0]); - int client = GetClientOfUserId(userid); - if(client == 0) { - ReplyToCommand(param1, "FTT: Could not acquire player"); + int victim = GetClientOfUserId(userid); + if(victim == 0) { + ReplyToCommand(param1, "FTT/ChooseCategoryHandler: Could not acquire player"); return 0; } @@ -171,7 +171,7 @@ public int ChooseModeMenuHandler(Menu menu, MenuAction action, int param1, int p if (action == MenuAction_Cancel) { if(param2 == MenuCancel_ExitBack) { if(iMenuVictimID[param1] == 0) { - ReplyToCommand(param1, "FTT: Could not acquire player"); + ReplyToCommand(param1, "FTT/ChooseModeMenuHandler: Could not acquire player"); } SetupCategoryMenu(param1, iMenuVictimID[param1]); } @@ -236,6 +236,8 @@ public int ChooseClumsySlotHandler(Menu menu, MenuAction action, int param1, int for(int i = 0; i <= 4; i++) { ThrowItemToPlayer(client, param1, i); } + } else if(slot == -2) { + ShowThrowItAllMenu(param1, userid); } else { ThrowItemToPlayer(client, param1, slot); } @@ -343,6 +345,7 @@ public void StopItemGive(int client) { } void SetupCategoryMenu(int client, int victimUserID) { + iMenuVictimID[client] = victimUserID; Menu categoryMenu = new Menu(ChooseCategoryHandler); static char category[64], id[16]; // Title with [ in name cause failure @@ -495,6 +498,9 @@ void ShowThrowItAllMenu(int client, int userid) { itmMenu.SetTitle("Choose Item To Throw"); static char itmName[32]; + Format(info, sizeof(info), "%d|-2", userid); + itmMenu.AddItem(info, "Refresh"); + Format(info, sizeof(info), "%d|-1", userid); itmMenu.AddItem(info, "All Items"); diff --git a/scripting/include/feedthetrolls/trolls.inc b/scripting/include/feedthetrolls/trolls.inc index a7e82c4..c2bc2a6 100644 --- a/scripting/include/feedthetrolls/trolls.inc +++ b/scripting/include/feedthetrolls/trolls.inc @@ -21,7 +21,6 @@ void SetupTrolls() { #if defined _behavior_included index = SetupTroll("Witch Magnet", "All witches when startled will target any player with this troll", TrollMod_Constant); #endif - // fireSpitMagnetTrollIndex = SetupTroll("Fire & Acid Magnet", "Make the player gravitate toward danger", TRollMod_Constant); /// CATEGORY: Infected SetCategory("Infected");