-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fixed LR not being properly resolved - Removed glocks from last guard - LRs that TP the CT will now freeze the prisoner for 1 second longer than the CT.
- Loading branch information
Showing
13 changed files
with
157 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
namespace Jailbreak.LastGuard; | ||
|
||
public class LastGuardConfig { | ||
public string? LastGuardWeapon { get; } = "weapon_glock"; | ||
public string? LastGuardWeapon { get; } = ""; | ||
public int MinimumCTs { get; } = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 64 additions & 39 deletions
103
mod/Jailbreak.Logs/Listeners/LogEntityParentListeners.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,90 @@ | ||
using CounterStrikeSharp.API; | ||
using CounterStrikeSharp.API.Core; | ||
using CounterStrikeSharp.API.Core.Attributes.Registration; | ||
using Jailbreak.Formatting.Views.Logging; | ||
using Jailbreak.Public.Behaviors; | ||
using Jailbreak.Public.Extensions; | ||
|
||
namespace Jailbreak.Logs.Listeners; | ||
|
||
public class LogEntityParentListeners(IRichLogService logs) : IPluginBehavior { | ||
private static readonly string[] WEAPON_STRINGS = [ | ||
"weapon_ak47", "weapon_aug", "weapon_awp", "weapon_bizon", "weapon_cz75a", | ||
"weapon_deagle", "weapon_famas", "weapon_fiveseven", "weapon_g3sg1", | ||
public class LogEntityParentListeners(IRichLogService logs) : IPluginBehavior | ||
{ | ||
private static readonly string[] WEAPON_STRINGS = [ | ||
"weapon_ak47", "weapon_aug", "weapon_awp", "weapon_bizon", "weapon_cz75a", | ||
"weapon_deagle", "weapon_elite", "weapon_famas", "weapon_fiveseven", "weapon_g3sg1", | ||
"weapon_galilar", "weapon_glock", "weapon_hkp2000", "weapon_m249", | ||
"weapon_m4a1", "weapon_m4a1_silencer", "weapon_m4a4", "weapon_mac10", | ||
"weapon_mag7", "weapon_mp5sd", "weapon_mp7", "weapon_mp9", "weapon_negev", | ||
"weapon_nova", "weapon_p250", "weapon_p90", "weapon_revolver", | ||
"weapon_sawedoff", "weapon_scar20", "weapon_sg553", "weapon_sg556", | ||
"weapon_ssg08", "weapon_taser", "weapon_tec9", "weapon_ump45", | ||
"weapon_usp_silencer", "weapon_xm1014" | ||
]; | ||
"weapon_usp_silencer", "weapon_xm1014", "item_kevlar", "item_assaultsuit", | ||
"weapon_snowball", "weapon_shield", "weapon_c4", "weapon_healthshot", | ||
"weapon_breachcharge", "weapon_tablet", "weapon_bumpmine", "weapon_smokegrenade", | ||
"weapon_flashbang", "weapon_hegrenade", "weapon_molotov", "weapon_incgrenade", | ||
"weapon_decoy", "weapon_tagrenade", "weapon_frag", "weapon_firebomb", | ||
"weapon_diversion", "weapon_knife_t", "weapon_knife" | ||
]; | ||
|
||
public void Start(BasePlugin _parent) { | ||
_parent | ||
.RegisterListener< | ||
CounterStrikeSharp.API.Core.Listeners.OnEntityParentChanged>( | ||
OnEntityParentChanged); | ||
} | ||
private readonly HashSet<int> recentWeaponEvents = new(); | ||
|
||
public void OnEntityParentChanged(CEntityInstance affectedEntity, | ||
CEntityInstance newParent) { | ||
if (!affectedEntity.IsValid | ||
|| !WEAPON_STRINGS.Contains(affectedEntity.DesignerName)) | ||
return; | ||
public void Start(BasePlugin _parent) | ||
{ | ||
_parent | ||
.RegisterListener< | ||
CounterStrikeSharp.API.Core.Listeners.OnEntityParentChanged>( | ||
OnEntityParentChanged); | ||
} | ||
|
||
var weaponEntity = | ||
Utilities.GetEntityFromIndex<CCSWeaponBase>((int)affectedEntity.Index); | ||
if (weaponEntity == null | ||
|| weaponEntity.PrevOwner.Get()?.OriginalController.Get() == null) | ||
return; | ||
public void OnEntityParentChanged(CEntityInstance affectedEntity, | ||
CEntityInstance newParent) | ||
{ | ||
if (!affectedEntity.IsValid | ||
|| !WEAPON_STRINGS.Contains(affectedEntity.DesignerName)) | ||
return; | ||
|
||
var weaponOwner = weaponEntity.PrevOwner.Get()?.OriginalController.Get(); | ||
if (weaponOwner == null) return; | ||
var weaponEntity = | ||
Utilities.GetEntityFromIndex<CCSWeaponBase>((int)affectedEntity.Index); | ||
if (weaponEntity == null | ||
|| weaponEntity.PrevOwner.Get()?.OriginalController.Get() == null) | ||
return; | ||
|
||
if (!newParent.IsValid) // a.k.a parent is world | ||
{ | ||
logs.Append(logs.Player(weaponOwner), | ||
$"dropped their {weaponEntity.ToFriendlyString()}"); | ||
return; | ||
} | ||
var weaponOwner = weaponEntity.PrevOwner.Get()?.OriginalController.Get(); | ||
if (weaponOwner == null) return; | ||
|
||
var weaponPickerUpper = Utilities | ||
if (!newParent.IsValid) // a.k.a parent is world | ||
{ | ||
logs.Append(logs.Player(weaponOwner), | ||
$"dropped their {weaponEntity.ToFriendlyString()}"); | ||
return; | ||
} | ||
|
||
if (!recentWeaponEvents.Add((int)weaponEntity.Index)) | ||
{ | ||
recentWeaponEvents.Remove((int)weaponEntity.Index); | ||
return; | ||
} | ||
|
||
var weaponPickerUpper = Utilities | ||
.GetEntityFromIndex<CCSPlayerPawn>((int)newParent.Index) | ||
?.OriginalController.Get(); | ||
if (weaponPickerUpper == null) return; | ||
if (weaponPickerUpper == null) return; | ||
|
||
if (weaponPickerUpper == weaponOwner) | ||
{ | ||
logs.Append(weaponPickerUpper, | ||
$"picked up their {weaponEntity.ToFriendlyString()}"); | ||
return; | ||
} | ||
|
||
if (weaponPickerUpper == weaponOwner) { | ||
logs.Append(weaponPickerUpper, | ||
$"picked up their {weaponEntity.ToFriendlyString()}"); | ||
return; | ||
logs.Append(weaponPickerUpper, "picked up", logs.Player(weaponOwner), | ||
$"{weaponEntity.ToFriendlyString()}"); | ||
} | ||
|
||
logs.Append(weaponPickerUpper, "picked up", logs.Player(weaponOwner), | ||
$"{weaponEntity.ToFriendlyString()}"); | ||
} | ||
[GameEventHandler] | ||
public HookResult OnRoundEnd(EventRoundEnd @event, GameEventInfo info) | ||
{ | ||
recentWeaponEvents.Clear(); | ||
return HookResult.Continue; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.