Commit 6309a30f authored by Mikleo's avatar Mikleo

--

parent e5eeb427
Pipeline #9042 passed with stages
in 14 seconds
......@@ -9,7 +9,7 @@
#include <updater>
#define PluginVersion "0.90"
#define PluginVersion "0.91"
float pVersion;
// note linearmap field is unstable
......@@ -43,7 +43,7 @@ float grabbedAngleDifference[MAXPLAYERS+1] = {0.0, ...};
float grabDistance [MAXPLAYERS+1] = {0.0, ...};
float grabOffset [MAXPLAYERS+1] = {0.0, ...};
bool lockgrabheight [MAXPLAYERS+1] = {false, ...};
bool lockgrabaxis [MAXPLAYERS+1][3];
bool lockgrabrotation [MAXPLAYERS+1] = {false, ...};
......@@ -162,7 +162,7 @@ public void OnPluginStart()
RegConsoleCmd("sm_entcontextheight", Command_Ent_ContextHeight);
RegConsoleCmd("sm_entcontextangle", Command_Ent_ContextAngle);
RegConsoleCmd("sm_gridsize", Command_Player_Grid_Size);
RegConsoleCmd("sm_lockgrabheight", Command_Lock_Grab_Height);
RegConsoleCmd("sm_lockgrabaxis", Command_Lock_Grab_Axis);
RegConsoleCmd("sm_lockgrabrotation", Command_Lock_Grab_Rotation);
......@@ -263,7 +263,9 @@ public void OnLibraryAdded(const char[] name)
public OnClientConnected(int client)
{
playerGridSize[client] = 0.1;
lockgrabheight[client] = false;
lockgrabaxis[client][0] = false;
lockgrabaxis[client][1] = false;
lockgrabaxis[client][2] = false;
lockgrabrotation[client] = false;
}
public OnMapStart()
......@@ -2761,21 +2763,31 @@ public Action:Hook_Grab(grabbingClient,client)
pos[0]+=eyeDir[0]*distance;
pos[1]+=eyeDir[1]*distance;
pos[2]+=grabOffset[client];
if(lockgrabheight[client])
{
float entityPos[3];
GetEntPropVector(grabbedEntity[client], Prop_Send, "m_vecOrigin", entityPos);
float entityPos[3];
GetEntPropVector(grabbedEntity[client], Prop_Send, "m_vecOrigin", entityPos);
if(lockgrabaxis[client][0])
{
pos[0] = entityPos[0];
}
if(lockgrabaxis[client][1])
{
pos[1] = entityPos[1];
}
if(lockgrabaxis[client][2])
{
pos[2] = entityPos[2];
}
decl Float:propAng[3];
GetEntPropVector(entity, Prop_Send, "m_angRotation", propAng);
if(lockgrabrotation[client])
propAng[1] = eyeAngles[1] + grabbedAngleDifference[client];
......@@ -5241,7 +5253,7 @@ public Action Command_Player_Grid_Size(int client, int args)
return Plugin_Handled;
}
public Action Command_Lock_Grab_Height(int client, int args)
public Action Command_Lock_Grab_Axis(int client, int args)
{
if(!CanEditMap(client))
{
......@@ -5250,12 +5262,18 @@ public Action Command_Lock_Grab_Height(int client, int args)
if(client == 0)
client = 1;
lockgrabheight[client] = !lockgrabheight[client];
char arg[64];
GetCmdArg(1, arg, sizeof(arg));
int axis = StringToInt(arg);
if(axis > 2 || axis <0)
axis = 0;
lockgrabaxis[client][axis] = !lockgrabaxis[client][axis];
if(lockgrabheight[client])
PrintToChat(client,"grab height locked");
if(lockgrabaxis[client][axis])
PrintToChat(client,"grab axis %d locked",axis);
else
PrintToChat(client,"grab height unlocked");
PrintToChat(client,"grab axis %d unlocked",axis);
return Plugin_Handled;
}
......
......@@ -36,5 +36,7 @@ bind "l" "sm_entcontextangle 5 z"
bind "CTRL" "+movedown"
bind "SPACE" "+moveup"
bind "f1" "sm_lockgrabheight"
bind "f2" "sm_lockgrabrotation"
bind "f1" "sm_lockgrabrotation"
bind "f2" "sm_lockgrabaxis 0"
bind "f3" "sm_lockgrabaxis 1"
bind "f4" "sm_lockgrabaxis 2"
......@@ -4,7 +4,7 @@
{
"Version"
{
"Latest" "0.90"
"Latest" "0.92"
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment