Skip to content

Commit

Permalink
Revert namespace modification that requires global:: prefix for Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
MSWS committed Sep 17, 2024
1 parent f43214b commit b21188a
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion mod/Jailbreak.LastGuard/LastGuard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private bool playerHasGun(CCSPlayerController player) {
if (weapons == null) return false;
foreach (var weapon in weapons.MyWeapons) {
if (weapon.Value == null) continue;
if (!global::Tag.GUNS.Contains(weapon.Value.DesignerName)) continue;
if (!Tag.GUNS.Contains(weapon.Value.DesignerName)) continue;
return true;
}

Expand Down
4 changes: 2 additions & 2 deletions mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public void Start(BasePlugin _parent) {
public void OnEntityParentChanged(CEntityInstance affectedEntity,
CEntityInstance newParent) {
if (!affectedEntity.IsValid) return;
if (!global::Tag.WEAPONS.Contains(affectedEntity.DesignerName)
&& !global::Tag.UTILITY.Contains(affectedEntity.DesignerName))
if (!Tag.WEAPONS.Contains(affectedEntity.DesignerName)
&& !Tag.UTILITY.Contains(affectedEntity.DesignerName))
return;

var weaponEntity =
Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.RTD/Rewards/AmmoWeaponReward.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AmmoWeaponReward : WeaponReward {

public AmmoWeaponReward(string weapon, int primary, int secondary,
CsTeam requiredTeam = CsTeam.Terrorist) : base(weapon, requiredTeam) {
Trace.Assert(global::Tag.GUNS.Contains(weapon));
Trace.Assert(Tag.GUNS.Contains(weapon));
this.primary = primary;
this.secondary = secondary;
}
Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.RTD/Rewards/CannotScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ override protected void tick(CCSPlayerController player) {
if (weaponServices == null) return;
var activeWeapon = weaponServices.ActiveWeapon.Value;
if (activeWeapon == null || !activeWeapon.IsValid) return;
if (!global::Tag.SNIPERS.Contains(activeWeapon.DesignerName)) return;
if (!Tag.SNIPERS.Contains(activeWeapon.DesignerName)) return;
activeWeapon.NextSecondaryAttackTick = Server.TickCount + 500;
}
}
2 changes: 1 addition & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/HideAndSeekDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class HideAndSeekDay(BasePlugin plugin, IServiceProvider provider)
public static readonly FakeConVar<string> CV_GUARD_WEAPONS = new(
"jb_sd_hns_weapons_ct",
"List of weapons/items CTs may use, empty for no restrictions",
string.Join(",", global::Tag.PISTOLS.Union(global::Tag.UTILITY)),
string.Join(",", Tag.PISTOLS.Union(Tag.UTILITY)),
ConVarFlags.FCVAR_NONE, new ItemValidator(allowMultiple: true));

public static readonly FakeConVar<string> CV_PRISONER_WEAPONS = new(
Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/InfectionDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public InfectionSettings() {

public override ISet<string>? AllowedWeapons(CCSPlayerController player) {
return player.Team == CsTeam.CounterTerrorist ?
global::Tag.UTILITY.Union(global::Tag.PISTOLS).ToHashSet() :
Tag.UTILITY.Union(Tag.PISTOLS).ToHashSet() :
null;
}

Expand Down
2 changes: 1 addition & 1 deletion mod/Jailbreak.SpecialDay/SpecialDays/NoScopeDay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class NoScopeDay(BasePlugin plugin, IServiceProvider provider)
"jb_sd_noscope_allowedweapons",
"Weapons to allow players to use, empty for no restrictions",
string.Join(",",
global::Tag.UTILITY.Union(new[] { "weapon_ssg08", "weapon_knife" }
Tag.UTILITY.Union(new[] { "weapon_ssg08", "weapon_knife" }
.ToHashSet())), ConVarFlags.FCVAR_NONE,
new ItemValidator(allowMultiple: true));

Expand Down
24 changes: 11 additions & 13 deletions public/Jailbreak.Tag/WeaponType.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
namespace Jailbreak.Tag;

[Flags]
[Flags]
public enum WeaponType {
GRENADE = 1 << 0, // 1
UTILITY = 1 << 1, // 2
Expand All @@ -20,25 +18,25 @@ public static IReadOnlySet<string> GetItems(this WeaponType type) {

switch (type) {
case WeaponType.GUNS:
return global::Tag.GUNS;
return Tag.GUNS;
case WeaponType.HEAVY:
return global::Tag.HEAVY;
return Tag.HEAVY;
case WeaponType.SMGS:
return global::Tag.SMGS;
return Tag.SMGS;
case WeaponType.SHOTGUNS:
return global::Tag.SHOTGUNS;
return Tag.SHOTGUNS;
case WeaponType.PISTOLS:
return global::Tag.PISTOLS;
return Tag.PISTOLS;
case WeaponType.RIFLES:
return global::Tag.RIFLES;
return Tag.RIFLES;
case WeaponType.SNIPERS:
return global::Tag.SNIPERS;
return Tag.SNIPERS;
case WeaponType.UTILITY:
return global::Tag.UTILITY;
return Tag.UTILITY;
case WeaponType.GRENADE:
return global::Tag.GRENADES;
return Tag.GRENADES;
case WeaponType.WEAPON:
return global::Tag.WEAPONS;
return Tag.WEAPONS;
default:
foreach (var t in Enum.GetValues<WeaponType>())
if (type.HasFlag(t))
Expand Down

0 comments on commit b21188a

Please sign in to comment.