removed trigger hooking entirely
This commit is contained in:
parent
714f73daff
commit
1d4bf1451c
@ -1,64 +1,79 @@
|
||||
# requirements
|
||||
dpkg --add-architecture i386
|
||||
dpkg --add-architecture i386
|
||||
|
||||
apt-update
|
||||
apt-update
|
||||
|
||||
apt install steam
|
||||
apt install steam
|
||||
|
||||
apt-get install mesa-utils
|
||||
apt-get install mesa-utils
|
||||
|
||||
apt install mesa-vulkan-drivers libglx-mesa0:i386 mesa-vulkan-drivers:i386 libgl1-mesa-dri:i386 libxtst6:i386 libpipewire-0.3-dev libbz2-dev
|
||||
apt install mesa-vulkan-drivers libglx-mesa0:i386 mesa-vulkan-drivers:i386 libgl1-mesa-dri:i386 libxtst6:i386 libpipewire-0.3-dev libbz2-dev
|
||||
|
||||
#intel specific:
|
||||
#intel specific:
|
||||
|
||||
apt-get remove xserver-xorg-video-intel
|
||||
apt-get remove xserver-xorg-video-intel
|
||||
|
||||
#fonts
|
||||
#fonts
|
||||
|
||||
dpkg-reconfigure locales
|
||||
dpkg-reconfigure locales
|
||||
|
||||
en_US.UTF 8
|
||||
en_US.UTF 8
|
||||
|
||||
apt install libgtk2.0-0:i386
|
||||
apt install libgtk2.0-0:i386
|
||||
|
||||
#debian
|
||||
#debian
|
||||
|
||||
hostname unloze.com
|
||||
hostname unloze.com
|
||||
|
||||
x2go or nomachine or VNC client/server setup <br/>
|
||||
steam account with css purchased
|
||||
# launch commands
|
||||
x2go or nomachine or VNC client/server setup <br/>
|
||||
steam account with css purchased
|
||||
# launch commands
|
||||
|
||||
cd /home/gameservers/.steam/debian-installation/ <br/>
|
||||
./steam.sh -applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi <br/>
|
||||
cd /home/gameservers/.steam/debian-installation/ <br/>
|
||||
./steam.sh -applaunch 240 -textmode -textmessagedebug -novid -nosound -noipx -nojoy -noshaderapi <br/>
|
||||
|
||||
/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg: <br/>
|
||||
alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop; <br/>
|
||||
(textmode is no video output) <br/>
|
||||
/home/gameservers/.steam/debian-installation/steamapps/common/Counter-Strike Source/cstrike/cfg/autoexec.cfg: <br/>
|
||||
alias loop "exec looptest.cfg; wait 5; loop;"; wait 5; loop; <br/>
|
||||
(textmode is no video output) <br/>
|
||||
|
||||
# do this before signing in to steam using VNC/x2go clients that are connected to VNC/x2go servers running virtual desktops
|
||||
use "glxinfo" with VNC or x2go client terminal to get information about ID's, for example 0x0e5.<br/> Running glxinfo on normal ssh terminals wont be usefull <br/>
|
||||
export SDL_VIDEO_X11_VISUALID=0x074 <br/>
|
||||
exporting correct SDL_VIDEO_X11_VISUALID value is important before steam login for starting games correctly <br/>
|
||||
instead of automating the steam login its done manually due to requiring x2go/VNC/nomachine clients.
|
||||
<br/> With the virtual desktop related to the VNC/x2go/nomachine client you can log into steam using the normal GUI -> <br/>
|
||||
once logged in steam can run actively for months without requiring restarts
|
||||
# do this before signing in to steam using VNC/x2go clients that are connected to VNC/x2go servers running virtual desktops
|
||||
use "glxinfo" with VNC or x2go client terminal to get information about ID's, for example 0x0e5.<br/> Running glxinfo on normal ssh terminals wont be usefull <br/>
|
||||
export SDL_VIDEO_X11_VISUALID=0x074 <br/>
|
||||
exporting correct SDL_VIDEO_X11_VISUALID value is important before steam login for starting games correctly <br/>
|
||||
instead of automating the steam login its done manually due to requiring x2go/VNC/nomachine clients.
|
||||
<br/> With the virtual desktop related to the VNC/x2go/nomachine client you can log into steam using the normal GUI -> <br/>
|
||||
once logged in steam can run actively for months without requiring restarts
|
||||
|
||||
## bashrc for x2go users
|
||||
in the users thats running a x2go session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
||||
## bashrc for x2go users
|
||||
in the users thats running a x2go session edit the .bashrc file and add the follwing (remember SDL_VIDEO_X11_VISUALID deppends on glxinfo from xterm terminal):
|
||||
|
||||
|
||||
if [[ $DISPLAY ]]; then
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
export SDL_VIDEO_X11_VISUALID=0x205
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
steam -no-browser -console #should reduce ram usage
|
||||
fi
|
||||
if [[ $DISPLAY ]]; then
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
export SDL_VIDEO_X11_VISUALID=0x205
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
#native libraries tried instead of runtime libraries for not crashing i suppose, no-browser -console should also save RAM usage
|
||||
#STEAM_RUNTIME=0 steam no-browser -console
|
||||
steam no-browser -console
|
||||
fi
|
||||
|
||||
##steam settings -> library -> low bandwith mode and low performance mode
|
||||
##steam settings -> library -> low bandwith mode and low performance mode
|
||||
|
||||
#X2GO_NXAGENT_DEFAULT_OPTIONS="-options nx/nx,sleep=0" /etc/x2go/x2goagent.options
|
||||
#X2GO_NXAGENT_DEFAULT_OPTIONS="-options nx/nx,sleep=0" /etc/x2go/x2goagent.options
|
||||
|
||||
#keeps session as R instead of S which is needed for interaction with graphical components such as steam and CS:S
|
||||
#keeps session as R instead of S which is needed for interaction with graphical components such as steam and CS:S
|
||||
|
||||
ovh: 0x205, 0x209
|
||||
ovh: 0x205, 0x209
|
||||
|
||||
#if running steam native libraries instead of runtime libraries one might require following apt install for making libpipewire work
|
||||
#specifically on debian steam
|
||||
apt install pipewire:i386
|
||||
apt-get install libbz2-1.0:i386
|
||||
|
||||
#further steam native libraries specifically for debian
|
||||
apt-get install libxtst6:i386 libxrandr2:i386 libglib2.0-0:i386 libgtk2.0-0:i386 libpulse0:i386 libgdk-pixbuf2.0-0:i386 libcurl4-openssl-dev:i386 libopenal1:i386 libusb-1.0-0:i386 libdbus-glib-1-2:i386
|
||||
apt-get install libsm6:i386
|
||||
|
||||
#check if all libs are present with
|
||||
cd ~/.steam/steam/ubuntu12_32
|
||||
LD_LIBRARY_PATH=. ldd vgui2_s.so
|
||||
|
@ -243,6 +243,7 @@ if [[ $DISPLAY ]]; then
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
export SDL_VIDEO_X11_VISUALID=0x205
|
||||
echo 'SDL_VIDEO_X11_VISUALID: ' $SDL_VIDEO_X11_VISUALID
|
||||
steam
|
||||
#native libraries being prefered over runtime here
|
||||
STEAM_RUNTIME=0 steam no-browser -console
|
||||
fi
|
||||
"""
|
||||
|
@ -22,7 +22,7 @@ int ports[7] = {48470, 48471, 48472, 48473, 48474, 48479, 48480}; //last three i
|
||||
int server_ports[2] = {27015, 27035}; //server ports: ze, ze2
|
||||
int bot_avoid_edge[MAXPLAYERS + 1];
|
||||
float client_old_coords[MAXPLAYERS + 1][3];
|
||||
float targethuman_teleported[MAXPLAYERS + 1][3];
|
||||
float targethuman_self_teleported[MAXPLAYERS + 1][3];
|
||||
bool chat_cooldown = false;
|
||||
|
||||
//admins & vips
|
||||
@ -48,58 +48,46 @@ public void OnPluginStart()
|
||||
{
|
||||
target_friend[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
OnClientPostAdminCheck(i);
|
||||
}
|
||||
//talking
|
||||
RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application");
|
||||
RegConsoleCmd("sm_botrtv", cmd_botrtv, "making bots rtv");
|
||||
|
||||
//hooks
|
||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||
HookEvent("round_end", Event_RoundEnd);
|
||||
//UDP connection
|
||||
connect_socket();
|
||||
chat_cooldown = false;
|
||||
}
|
||||
|
||||
public void reset_target_human_tp_coord(int client)
|
||||
public void reset_target_tp(int client)
|
||||
{
|
||||
targethuman_teleported[client][0] = 0.0;
|
||||
targethuman_teleported[client][1] = 0.0;
|
||||
targethuman_teleported[client][2] = 0.0;
|
||||
if (IsValidClient(client) && is_bot_player(client))
|
||||
{
|
||||
targethuman_self_teleported[client][0] = 0.0;
|
||||
targethuman_self_teleported[client][1] = 0.0;
|
||||
targethuman_self_teleported[client][2] = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public bool origin_command_check(int entity_index)
|
||||
public Action reset_target_tp_timer(Handle timer, int client)
|
||||
{
|
||||
int count_trigger = GetOutputCount(entity_index, "m_OnTrigger");
|
||||
int count_starttouch = GetOutputCount(entity_index, "m_OnStartTouch");
|
||||
for (int i = 0; i < count_trigger; i++)
|
||||
{
|
||||
char buffer[generic_length];
|
||||
GetOutputParameter(entity_index, "m_OnTrigger", i, buffer, sizeof(buffer));
|
||||
if (StrContains(buffer, "origin", true) != -1)
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < count_starttouch; i++)
|
||||
{
|
||||
char buffer[generic_length];
|
||||
GetOutputParameter(entity_index, "m_OnStartTouch", i, buffer, sizeof(buffer));
|
||||
if (StrContains(buffer, "origin", true) != -1)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Action reset_target_tp(Handle timer, int client)
|
||||
{
|
||||
reset_target_human_tp_coord(client);
|
||||
reset_target_tp(client);
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public bool distance_check(int client)
|
||||
public bool distance_check(int client, int botclient, bool nowpos)
|
||||
{
|
||||
float dist_target = get_power_distance(client, targethuman_teleported[client]);
|
||||
float dist_target = 0.0;
|
||||
if (nowpos)
|
||||
{
|
||||
float pos[3];
|
||||
GetEntPropVector(botclient, Prop_Send, "m_vecOrigin", pos);
|
||||
dist_target = get_power_distance(client, pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
dist_target = get_power_distance(client, targethuman_self_teleported[botclient]);
|
||||
}
|
||||
float min_required_distance = 50000.0;
|
||||
if (dist_target > min_required_distance)
|
||||
return false;
|
||||
@ -233,128 +221,17 @@ public Action bot_chat_cooldown(Handle timer, any data)
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void unhookAll()
|
||||
public void did_target_tp(int client, int bot_client)
|
||||
{
|
||||
int entity_tp = MaxClients + 1;
|
||||
int entity_mp = MaxClients + 1;
|
||||
while((entity_mp = FindEntityByClassname(entity_mp, "trigger_multiple")) != -1)
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_mp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
UnhookSingleEntityOutput(entity_mp, "OnStartTouch", OnEntityOutPut_mp);
|
||||
UnhookSingleEntityOutput(entity_mp, "OnTrigger", OnEntityOutPut_mp);
|
||||
}
|
||||
}
|
||||
while((entity_tp = FindEntityByClassname(entity_tp, "trigger_teleport")) != -1)
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_tp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
UnhookSingleEntityOutput(entity_tp, "OnStartTouch", OnEntityOutPut_tp);
|
||||
UnhookSingleEntityOutput(entity_tp, "OnTrigger", OnEntityOutPut_tp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
unhookAll();
|
||||
}
|
||||
|
||||
public void round_start_void()
|
||||
{
|
||||
unhookAll();
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i) && !IsFakeClient(i))
|
||||
if (client == bot_client && targethuman_self_teleported[client][0] != 0.0 && !distance_check(client, bot_client, false))
|
||||
{
|
||||
target_friend[i] = 0;
|
||||
target_enemy[i] = 0;
|
||||
reset_target_human_tp_coord(i);
|
||||
reset_target_tp(client);
|
||||
}
|
||||
int entity_tp = MaxClients + 1;
|
||||
int entity_mp = MaxClients + 1;
|
||||
while((entity_mp = FindEntityByClassname(entity_mp, "trigger_multiple")) != -1)
|
||||
else if (client != bot_client && targethuman_self_teleported[bot_client][0] == 0.0 && !distance_check(client, bot_client, true))
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_mp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
HookSingleEntityOutput(entity_mp, "OnStartTouch", OnEntityOutPut_mp, true);
|
||||
HookSingleEntityOutput(entity_mp, "OnTrigger", OnEntityOutPut_mp, true);
|
||||
}
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_self_teleported[bot_client]);
|
||||
CreateTimer(6.0, reset_target_tp_timer, bot_client);
|
||||
}
|
||||
while((entity_tp = FindEntityByClassname(entity_tp, "trigger_teleport")) != -1)
|
||||
{
|
||||
char targetName[64];
|
||||
GetEntPropString(entity_tp, Prop_Data, "m_iName", targetName, sizeof(targetName));
|
||||
if (strlen(targetName) > 0)
|
||||
{
|
||||
HookSingleEntityOutput(entity_tp, "OnStartTouch", OnEntityOutPut_tp, true);
|
||||
HookSingleEntityOutput(entity_tp, "OnTrigger", OnEntityOutPut_tp, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
round_start_void();
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_mp(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
if (IsValidEdict(entity_index) && origin_command_check(entity_index))
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
break;
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
{
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_mp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_mp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
DataPack dPack;
|
||||
CreateDataTimer(0.5, reset_hook_mp, dPack);
|
||||
dPack.WriteCell(entity_index);
|
||||
}
|
||||
|
||||
public void OnEntityOutPut_tp(const char[] output, int entity_index, int client, float delay)
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
//i is an autismbot following this player
|
||||
if (target_friend[i] == client)
|
||||
{
|
||||
GetEntPropVector(client, Prop_Send, "m_vecOrigin", targethuman_teleported[i]);
|
||||
CreateTimer(6.0, reset_target_tp, client);
|
||||
break;
|
||||
}
|
||||
else if (is_bot_player(i) && i == client)
|
||||
{
|
||||
CreateTimer(0.1, reset_target_tp, client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
UnhookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_tp);
|
||||
UnhookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_tp);
|
||||
//experimental if unhooking very shortly solves tp lag
|
||||
DataPack dPack;
|
||||
CreateDataTimer(0.5, reset_hook_tp, dPack);
|
||||
dPack.WriteCell(entity_index);
|
||||
}
|
||||
|
||||
public void OnMapStart()
|
||||
@ -588,30 +465,6 @@ public bool is_bot_player(int client)
|
||||
return is_autism_bot1(client) || is_autism_bot2(client) || is_autism_bot3(client) || is_autism_bot4(client);
|
||||
}
|
||||
|
||||
public Action reset_hook_mp(Handle timer, DataPack dPack)
|
||||
{
|
||||
dPack.Reset();
|
||||
int entity_index = dPack.ReadCell();
|
||||
if (IsValidEdict(entity_index))
|
||||
{
|
||||
HookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_mp, true);
|
||||
HookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_mp, true);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action reset_hook_tp(Handle timer, DataPack dPack)
|
||||
{
|
||||
dPack.Reset();
|
||||
int entity_index = dPack.ReadCell();
|
||||
if (IsValidEdict(entity_index))
|
||||
{
|
||||
HookSingleEntityOutput(entity_index, "OnStartTouch", OnEntityOutPut_tp, true);
|
||||
HookSingleEntityOutput(entity_index, "OnTrigger", OnEntityOutPut_tp, true);
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action recursive_pressing(Handle timer, any data)
|
||||
{
|
||||
bool found_valid_ct = false;
|
||||
@ -650,24 +503,33 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
//3 = autismo is human and should follow closest moving ct
|
||||
targeteam = 3;
|
||||
}
|
||||
if (targethuman_teleported[client][0] != 0.0)
|
||||
if (IsValidClient(target_friend[client]))
|
||||
{
|
||||
did_target_tp(target_friend[client], client);
|
||||
}
|
||||
else if (IsValidClient(target_enemy[client]))
|
||||
{
|
||||
did_target_tp(target_enemy[client], client);
|
||||
}
|
||||
if (targethuman_self_teleported[client][0] != 0.0)
|
||||
{
|
||||
float ClientPos[3];
|
||||
float Result[3];
|
||||
GetClientEyePosition(client, ClientPos);
|
||||
MakeVectorFromPoints(ClientPos, targethuman_teleported[client], Result);
|
||||
MakeVectorFromPoints(ClientPos, targethuman_self_teleported[client], Result);
|
||||
GetVectorAngles(Result, Result);
|
||||
TeleportEntity(client, NULL_VECTOR, Result, NULL_VECTOR);
|
||||
if (!distance_check(client))
|
||||
reset_target_human_tp_coord(client);
|
||||
if (!distance_check(client, client, false))
|
||||
reset_target_tp(client);
|
||||
continue;
|
||||
}
|
||||
//no target in water somehow
|
||||
//no target in water somehow
|
||||
target_enemy[client] = GetClosestClient_option1(false, client);
|
||||
target_friend[client] = GetClosestClient_option1(true, client);
|
||||
float pos[3];
|
||||
did_target_tp(client, client);
|
||||
float enemy_distance = -1.0;
|
||||
float dist_target = -1.0;
|
||||
float pos[3];
|
||||
if (IsValidClient(target_friend[client]))
|
||||
{
|
||||
GetEntPropVector(target_friend[client], Prop_Send, "m_vecOrigin", pos);
|
||||
@ -1008,6 +870,7 @@ public void OnClientPostAdminCheck(int client)
|
||||
client_old_coords[client][0] = 0.0;
|
||||
client_old_coords[client][1] = 0.0;
|
||||
client_old_coords[client][2] = 0.0;
|
||||
reset_target_tp(client);
|
||||
}
|
||||
|
||||
public void OnSocketError(Handle socket, const int errorType, const int errorNum, any args)
|
||||
@ -1052,6 +915,7 @@ public void OnClientDisconnect(int client)
|
||||
if (IsValidClient(i) && is_bot_player(i) && i != client)
|
||||
target_friend_afk_counter[i][client] = 0;
|
||||
}
|
||||
reset_target_tp(client);
|
||||
}
|
||||
|
||||
//Socket callback
|
||||
|
Loading…
Reference in New Issue
Block a user