Skip to content

Commit

Permalink
Fixed breakoob filter being set in reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
DosMike committed Jul 2, 2022
1 parent 4a9789d commit a992643
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tossbuildings.sp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#pragma newdecls required
#pragma semicolon 1

#define PLUGIN_VERSION "22w25b"
#define PLUGIN_VERSION "22w26a"

public Plugin myinfo = {
name = "[TF2] Toss Buildings",
Expand Down Expand Up @@ -59,7 +59,7 @@ int g_iBlockFlags;
#define TBFLAG_DISPENSER (1<<BUILDING_DISPENSER)
#define TBFLAG_TELEPORTER (1<<BUILDING_TELEPORTER)
#define TBFLAG_SENTRYGUN (1<<BUILDING_SENTRYGUN)
int g_iBlockTypes;
int g_iAllowTypes;
int g_iNoOOBTypes;
float g_flThrowForce;
float g_flUprightForce;
Expand Down Expand Up @@ -130,7 +130,7 @@ public void LockConVar(ConVar convar, const char[] oldValue, const char[] newVal
if (!StrEqual(newValue, PLUGIN_VERSION)) convar.SetString(PLUGIN_VERSION);
}
public void OnTossBuildingTypesChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
_ParseTypesTo(g_iBlockTypes, newValue);
_ParseTypesTo(g_iAllowTypes, newValue);
}
public void OnTossBuildingForceChanged(ConVar convar, const char[] oldValue, const char[] newValue) {
g_flThrowForce = convar.FloatValue;
Expand All @@ -143,19 +143,19 @@ public void OnTossBuildingUprightChanged(ConVar convar, const char[] oldValue, c
}
static void _ParseTypesTo(int& value, const char[] typesString) {
if (StrContains(typesString, "dispenser", false)>=0) {
value &=~ TBFLAG_DISPENSER;
} else {
value |= TBFLAG_DISPENSER;
} else {
value &=~ TBFLAG_DISPENSER;
}
if (StrContains(typesString, "teleporter", false)>=0) {
value &=~ TBFLAG_TELEPORTER;
} else {
value |= TBFLAG_TELEPORTER;
} else {
value &=~ TBFLAG_TELEPORTER;
}
if (StrContains(typesString, "sentry", false)>=0) {
value &=~ TBFLAG_SENTRYGUN;
} else {
value |= TBFLAG_SENTRYGUN;
} else {
value &=~ TBFLAG_SENTRYGUN;
}
}

Expand Down Expand Up @@ -209,7 +209,7 @@ public void OnPlayerCarryObject(Event event, const char[] name, bool dontBroadca
int owner = GetClientOfUserId(event.GetInt("userid"));
int objecttype = event.GetInt("object");
int building = event.GetInt("index");
if ((BUILDING_DISPENSER <= objecttype <= BUILDING_SENTRYGUN) && IsClientInGame(owner) && IsValidEdict(building) && ( g_iBlockTypes&(1<<objecttype) )==0) {
if ((BUILDING_DISPENSER <= objecttype <= BUILDING_SENTRYGUN) && IsClientInGame(owner) && IsValidEdict(building) && ( g_iAllowTypes&(1<<objecttype) )!=0) {
//small sanity check: was this building picked up while flagged as thrown?
if (g_aAirbornObjects.FindValue(EntIndexToEntRef(building), AirbornData::building) != -1) {
//visually destory the building, the check timer will clean up the phys prop later
Expand Down Expand Up @@ -504,7 +504,7 @@ bool IsThrowBlocked(int client) {
if (!(BUILDING_DISPENSER <= type <= BUILDING_SENTRYGUN))
return false; //supported buildings, not always correct on weapon_builder

return ( g_iBlockTypes&(1<<type) )!=0;
return ( g_iAllowTypes&(1<<type) )==0;
}

bool CheckThrowPos(int client) {
Expand Down

0 comments on commit a992643

Please sign in to comment.