TnmsExtendableTargeting.Shared 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package TnmsExtendableTargeting.Shared --version 0.0.1
                    
NuGet\Install-Package TnmsExtendableTargeting.Shared -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TnmsExtendableTargeting.Shared" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TnmsExtendableTargeting.Shared" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="TnmsExtendableTargeting.Shared" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TnmsExtendableTargeting.Shared --version 0.0.1
                    
#r "nuget: TnmsExtendableTargeting.Shared, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TnmsExtendableTargeting.Shared@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TnmsExtendableTargeting.Shared&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=TnmsExtendableTargeting.Shared&version=0.0.1
                    
Install as a Cake Tool

TnmsExtendableTargeting

What is this?

This module provides extendable targeting functionality.

It offers the following types of targeting:

  • @prefix - Target without parameters
  • @prefix=value - Target with parameters

Built-in Targets

The following targeting options are provided out of the box:

Target String Description Example
@me Targets yourself. @me
@!me Targets everyone except yourself. @!me
@aim Targets the player you are aiming at. @aim
@ct Targets players on the CT team. @ct
@t Targets players on the T team. @t
@spec Targets spectators. @spec
@bot Targets bot players. @bot
@human Targets human players. @human
@alive Targets alive players. @alive
@dead Targets dead players. @dead
#<number> Targets by SteamID or UserID. #12345

Usage

Dependencies

Install TnmsExtendableTargeting.Shared from NuGet:

dotnet add package TnmsExtendableTargeting.Shared

Example

You can obtain IExtendableTargeting as follows:

private IExtendableTargeting _extendableTargeting = null!;

public void OnAllModulesLoaded()
{
    var extendableTargeting = _sharedSystem.GetSharpModuleManager()
        .GetRequiredSharpModuleInterface<IExtendableTargeting>(IExtendableTargeting.ModSharpModuleIdentity).Instance;
    _extendableTargeting = extendableTargeting ?? throw new InvalidOperationException("TnmsExtendableTargeting is not found! Make sure TnmsExtendableTargeting is installed!");
}

Then, resolve targets as follows:

if(_extendableTargeting.ResolveTarget(targetString, player, out var foundTargets))
{
    // Do something with foundTargets
}

Creating Custom Targets

As the name suggests, ExtendableTargeting allows you to add and extend custom targets.

Once added, custom targets can be used anywhere IExtendableTargeting.ResolveTarget is used. In other words, they are available in all modules that use this functionality.

Custom Targets Without Parameters

Register a custom target without parameters using IExtendableTargeting.RegisterCustomTarget.

The prefix must start with @. If it does not, @ will be automatically prepended.

Examples:

  • @mytarget@mytarget
  • mytarget@mytarget
  • $mytarget@$mytarget
IExtendableTargeting.RegisterCustomTarget("@me", Me);

public static bool Me(IGameClient targetClient, IGameClient? caller)
{
    return caller?.Slot == targetClient.Slot;
}

Custom Targets With Parameters

Register a custom target with parameters using IExtendableTargeting.RegisterCustomTargetWithParam.

The prefix must start with @. If it does not, @ will be automatically prepended.

Examples:

  • @mytarget@mytarget
  • mytarget@mytarget
  • $mytarget@$mytarget
IExtendableTargeting.RegisterCustomTargetWithParam("@slot", Slot);
public static bool Slot(string param, IGameClient targetClient, IGameClient? caller)
{
    if(int.TryParse(param, out var slot))
    {
        return targetClient.Slot == slot;
    }
    return false;
}

Custom targets with parameters can be used in the form @prefix=value.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on TnmsExtendableTargeting.Shared:

Package Downloads
TnmsPluginFoundation

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 1,018 11/17/2025
0.1.0 348 11/11/2025
0.0.3 159 11/8/2025
0.0.2 248 11/7/2025
0.0.1 225 10/28/2025
0.0.0 223 10/9/2025