-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable item dropping for a few NPCs in of0a0
- Loading branch information
1 parent
d456883
commit ca4339c
Showing
2 changed files
with
30 additions
and
0 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
29 changes: 29 additions & 0 deletions
29
...HalfLife.UnifiedSdk.MapUpgrader.Upgrades/OpposingForce/Of0a0DisableItemDroppingUpgrade.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using HalfLife.UnifiedSdk.Utilities.Entities; | ||
using HalfLife.UnifiedSdk.Utilities.Tools.UpgradeTool; | ||
using System.Collections.Immutable; | ||
|
||
namespace HalfLife.UnifiedSdk.MapUpgrader.Upgrades.OpposingForce | ||
{ | ||
/// <summary> | ||
/// Disables item dropping for a couple NPCs in the Opposing Force intro map so players can't get weapons from them if they die. | ||
/// </summary> | ||
internal sealed class Of0a0DisableItemDroppingUpgrade : MapSpecificUpgradeAction | ||
{ | ||
private static readonly ImmutableArray<string> NPCTargetNames = ImmutableArray.Create( | ||
"ichabod", | ||
"booth"); | ||
|
||
public Of0a0DisableItemDroppingUpgrade() | ||
: base("of0a0") | ||
{ | ||
} | ||
|
||
protected override void ApplyCore(MapUpgradeContext context) | ||
{ | ||
foreach (var entity in context.Map.Entities.Where(e => NPCTargetNames.Contains(e.GetTargetName()))) | ||
{ | ||
entity.SetInteger("allow_item_dropping", 0); | ||
} | ||
} | ||
} | ||
} |