Skip to content

Commit

Permalink
修复1vht和witchparty模式可能少特的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
fantasylidong committed Dec 1, 2022
1 parent dd6b12c commit 4d04756
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
Binary file modified addons/sourcemod/plugins/optional/AnneHappy/infected_control.smx
Binary file not shown.
Binary file not shown.
29 changes: 22 additions & 7 deletions addons/sourcemod/scripting/AnneHappy/infected_control.sp
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,6 @@ public int CheckSIOption(int type){
// 当前某种特感数量是否达到 Convar 值限制
bool HasReachedLimit(int zombieclass)
{
if(g_hAllChargerMode.BoolValue || g_hAllHunterMode.BoolValue){
return false;
}
int count = 0; char convar[16] = {'\0'};
for (int infected = 1; infected <= MaxClients; infected++)
{
Expand All @@ -709,6 +706,12 @@ bool HasReachedLimit(int zombieclass)
count += 1;
}
}
if((g_hAllChargerMode.BoolValue || g_hAllHunterMode.BoolValue) && count == g_iSiLimit){
return true;
}
else if((g_hAllChargerMode.BoolValue || g_hAllHunterMode.BoolValue) && count < g_iSiLimit){
return false;
}
FormatEx(convar, sizeof(convar), "z_%s_limit", InfectedName[zombieclass]);
if (count == GetConVarInt(FindConVar(convar)))
{
Expand All @@ -723,7 +726,7 @@ bool HasReachedLimit(int zombieclass)
stock void print_type(int iType, float SpawnDistance, bool Isteleport = false){
if (iType >= 1 && iType <=6)
{
Debug_Print(" %s生成一只%s,当前%s数量:%d,特感总数量 %d,找位最大单位距离:%f", Isteleport?"传送":"", InfectedName[iType], InfectedName[iType], g_iSINum[iType -1], g_iTotalSINum, SpawnDistance);
Debug_Print(" %s生成一只%s,当前%s数量:%d,特感总数量 %d, 真实特感数量:%d, 找位最大单位距离:%f", Isteleport?"传送":"", InfectedName[iType], InfectedName[iType], g_iSINum[iType -1], g_iTotalSINum, GetCurrentSINum(), SpawnDistance);
}
}

Expand Down Expand Up @@ -1135,7 +1138,7 @@ public Action Timer_PositionSi(Handle timer)
//每1s找一次跑男或者是否所有全被控
if(CheckRushManAndAllPinned())
{
return Plugin_Continue;
return Plugin_Stop;
}
for (int client = 1; client <= MaxClients; client++)
{
Expand All @@ -1154,7 +1157,7 @@ public Action Timer_PositionSi(Handle timer)
}
aTeleportQueue.Push(type);
g_iTeleportIndex += 1;
Debug_Print("<传送队列> %N踢出,进入传送队列,当前 <传送队列> 队列长度:%d 队列索引:%d", client, aTeleportQueue.Length, g_iTeleportIndex);
Debug_Print("<传送队列> %N踢出,进入传送队列,当前 <传送队列> 队列长度:%d 队列索引:%d 当前记录特感总数为:%d , 真实数量为:%d", client, aTeleportQueue.Length, g_iTeleportIndex, g_iTotalSINum, GetCurrentSINum());
//不再单独处理spitter防止无声口水,已经在canbeteleport处理
if(g_iSINum[type - 1] > 0)
{
Expand All @@ -1173,7 +1176,7 @@ public Action Timer_PositionSi(Handle timer)
g_iTotalSINum = 0;
}
KickClient(client, "传送刷特,踢出");

Debug_Print("当前 <传送队列> 队列长度:%d 队列索引:%d 当前记录特感总数为:%d , 真实数量为:%d", aTeleportQueue.Length, g_iTeleportIndex, g_iTotalSINum, GetCurrentSINum());
g_iTeleCount[client] = 0;
}
}
Expand All @@ -1190,6 +1193,18 @@ public Action Timer_PositionSi(Handle timer)
return Plugin_Continue;
}

stock int GetCurrentSINum()
{
int sum = 0;
for(int i = 0; i < MaxClients; i++){
if(IsInfectedBot(i) && !IsAiTank(i))
{
sum ++;
}
}
return sum;
}

stock bool IsSpitter(int client)
{
if (IsInfectedBot(client) && IsPlayerAlive(client) && GetEntProp(client, Prop_Send, "m_zombieClass") == ZC_SPITTER)
Expand Down

0 comments on commit 4d04756

Please sign in to comment.