Skip to content

Commit

Permalink
Add upgrade to convert item_suit to use w_pcv.mdl for Opposing Force …
Browse files Browse the repository at this point in the history
…maps

malortie/custom-hl-viewmodels#47
  • Loading branch information
SamVanheer committed May 19, 2022
1 parent 1eb49ae commit 5094a70
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using HalfLife.UnifiedSdk.Utilities.Entities;
using HalfLife.UnifiedSdk.Utilities.Games;
using HalfLife.UnifiedSdk.Utilities.Tools.UpgradeTool;

namespace HalfLife.UnifiedSdk.MapUpgrader.Upgrades
{
/// <summary>
/// Converts <c>item_suit</c>'s model to use <c>w_pcv.mdl</c> in Opposing Force maps.
/// </summary>
internal sealed class ConvertSuitToPCVUpgrade : IMapUpgradeAction
{
public void Apply(MapUpgradeContext context)
{
if (!ValveGames.OpposingForce.IsMap(context.Map.BaseName))
{
return;
}

foreach (var entity in context.Map.Entities.OfClass("item_suit"))
{
entity.SetModel("models/w_pcv.mdl");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public static MapUpgradeBuilder AddHalfLifeUpgrades(this MapUpgradeBuilder build

public static MapUpgradeBuilder AddOpposingForceUpgrades(this MapUpgradeBuilder builder)
{
builder.AddAction(new ConvertSuitToPCVUpgrade());
builder.AddAction(new MonsterTentacleSpawnFlagUpgrade());
builder.AddAction(new Of4a4BridgeUpgrade());
return builder;
Expand Down

0 comments on commit 5094a70

Please sign in to comment.