Skip to content

Commit 1307bd3

Browse files
v5.5
- Display Color of prop when display (bees suggestion) - Mouse2 can resize prop from size 0.1 - 10.0 - Changed metadata url
1 parent a7e8fd0 commit 1307bd3

2 files changed

Lines changed: 26 additions & 8 deletions

File tree

plugins/TF2Sandbox-PhysicsGun.smx

268 Bytes
Binary file not shown.

scripting/TF2Sandbox-PhysicsGun.sp

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#define DEBUG
44

55
#define PLUGIN_AUTHOR "BattlefieldDuck"
6-
#define PLUGIN_VERSION "5.41"
6+
#define PLUGIN_VERSION "5.5"
77

88
#include <sourcemod>
99
#include <sdkhooks>
@@ -19,7 +19,7 @@ public Plugin myinfo =
1919
author = PLUGIN_AUTHOR,
2020
description = "Brings physics gun feature to tf2! (Sandbox version)",
2121
version = PLUGIN_VERSION,
22-
url = "https://github.com/BattlefieldDuck/TF2_PhysicsGun"
22+
url = "https://github.com/TF2-Sandbox-Studio/Module-PhysicsGun"
2323
};
2424

2525
public const float ZERO_VECTOR[3] = {0.0, 0.0, 0.0};
@@ -736,7 +736,7 @@ stock void ClientSettings(int client, int &buttons, int &impulse, float vel[3],
736736
//Fix client eyes angles
737737
int EntityFlags = GetEntityFlags(client);
738738

739-
if (buttons & IN_RELOAD || buttons & IN_ATTACK3)
739+
if (buttons & IN_RELOAD || buttons & IN_ATTACK2 || buttons & IN_ATTACK3)
740740
{
741741
if(!(EntityFlags & FL_FROZEN))
742742
{
@@ -874,7 +874,7 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
874874
{
875875
TeleportEntity(iGrabPoint, fAimpos, NULL_VECTOR, NULL_VECTOR);
876876

877-
if (buttons & IN_RELOAD || buttons & IN_ATTACK3)
877+
if (buttons & IN_RELOAD || buttons & IN_ATTACK2 || buttons & IN_ATTACK3)
878878
{
879879
//Rotate + Push and pull
880880
if (buttons & IN_RELOAD)
@@ -1038,6 +1038,17 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
10381038
}
10391039
}
10401040
}
1041+
//Resize
1042+
else if (buttons & IN_ATTACK2)
1043+
{
1044+
float fSize = GetEntPropFloat(iEntity, Prop_Send, "m_flModelScale");
1045+
1046+
fSize -= mouse[1] / 500.0;
1047+
1048+
fSize = (fSize < 0.1) ? 0.1 : (fSize > 10.0) ? 10.0 : fSize;
1049+
1050+
SetEntPropFloat(iEntity, Prop_Send, "m_flModelScale", fSize);
1051+
}
10411052
//Push and pull
10421053
else if (buttons & IN_ATTACK3)
10431054
{
@@ -1086,7 +1097,7 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
10861097

10871098
//Stick
10881099
SetVariantString("!activator");
1089-
AcceptEntityInput(iEntity, "SetParent", iGrabPoint);
1100+
AcceptEntityInput(iEntity, "SetParent", iGrabPoint);
10901101
}
10911102
}
10921103
}
@@ -1209,7 +1220,7 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
12091220
strMode = (g_bPhysGunMode[client]) ? "Garry's Mod" : "TF2Sandbox";
12101221

12111222
int color = GetPhysGunWorldModelSkin(client);
1212-
SetHudTextParams(0.75, 0.45, 0.05, g_iPhysicsGunColor[color][0], g_iPhysicsGunColor[color][1], g_iPhysicsGunColor[color][2], g_iPhysicsGunColor[color][3], 0, 0.0, 0.0, 0.0);
1223+
SetHudTextParams(0.73, 0.43, 0.1, g_iPhysicsGunColor[color][0], g_iPhysicsGunColor[color][1], g_iPhysicsGunColor[color][2], g_iPhysicsGunColor[color][3], 0, 0.0, 0.0, 0.0);
12131224

12141225
int iEntity = EntRefToEntIndex(g_iGrabEntityRef[client]);
12151226
if (iEntity != INVALID_ENT_REFERENCE)
@@ -1223,11 +1234,18 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
12231234

12241235
ShowSyncHudText(client, g_hSyncHints, "MODE: %s\n\nAngles: %i %i %i%s", strMode, RoundFloat(fPrintAngle[0]), RoundFloat(fPrintAngle[1]), RoundFloat(fPrintAngle[2]), strHints);
12251236
}
1237+
else if (buttons & IN_ATTACK2)
1238+
{
1239+
ShowSyncHudText(client, g_hSyncHints, "MODE: %s\n\nSize: %.2f", strMode, GetEntPropFloat(iEntity, Prop_Send, "m_flModelScale"));
1240+
}
12261241
else
12271242
{
12281243
char strClassname[64];
12291244
GetEntityClassname(iEntity, strClassname, sizeof(strClassname));
12301245

1246+
int r, g, b, a;
1247+
GetEntityRenderColor(iEntity, r, g, b, a);
1248+
12311249
char strUserName[64];
12321250
strUserName = "Unknown";
12331251

@@ -1239,10 +1257,10 @@ stock void PhysGunSettings(int client, int &buttons, int &impulse, float vel[3],
12391257

12401258
if (g_bShowHints[client])
12411259
{
1242-
Format(strHints, sizeof(strHints), "\n\n[MOUSE3] Pull/Push\n[R] Rotate\n[T] Smart Copy");
1260+
Format(strHints, sizeof(strHints), "\n\n[MOUSE2] Resize\n[MOUSE3] Pull/Push\n[R] Rotate\n[T] Smart Copy");
12431261
}
12441262

1245-
ShowSyncHudText(client, g_hSyncHints, "MODE: %s\n\nObject: %s\nName: %s\nOwner: %s%s", strMode, strClassname, GetEntityName(iEntity), strUserName, strHints);
1263+
ShowSyncHudText(client, g_hSyncHints, "MODE: %s\n\nObject: %s\nColor: %i %i %i %i\nName: %s\nOwner: %s%s", strMode, strClassname, r, g, b, a, GetEntityName(iEntity), strUserName, strHints);
12461264
}
12471265
}
12481266
else

0 commit comments

Comments
 (0)