Skip to content

Commit

Permalink
Disable item dropping for a few NPCs in of0a0
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Aug 3, 2022
1 parent d456883 commit ca4339c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public static MapUpgradeBuilder AddOpposingForceUpgrades(this MapUpgradeBuilder
builder.AddAction(new ConvertScientistItemUpgrade());
builder.AddAction(new RenameOtisAnimationsUpgrade());
builder.AddAction(new MonsterTentacleSpawnFlagUpgrade());
builder.AddAction(new Of0a0DisableItemDroppingUpgrade());
builder.AddAction(new Of1a4bChangeLoaderSkinUpgrade());
builder.AddAction(new Of4a4BridgeUpgrade());
builder.AddAction(new RenameBlackOpsAnimationsUpgrade());
Expand Down
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);
}
}
}
}

0 comments on commit ca4339c

Please sign in to comment.