Stripper:Source



1. Introduction

This is a small but flexible plugin which lets you filter and add entities to a map before it loads, much like Stripper2 for Half-Life 1, by botman. You can filter out entities with specific values or regular expressions, or declare new entities to be added. You can also specify per-map configuration options.

2. Installation

First, make sure you have the proper tools installed. You need Metamod:Source 1.1.2 or higher.
  1. Extract the zip file into your server's mod folder.
  2. Add the following line to your addons/metamod/metaplugins.ini file:
    addons/stripper/bin/stripper_mm
  3. You're done!

3. Configuration

Stripper:Source configuration files are stored in the following format:
filter:
{
"prop1" "val1"
"prop2" "/val2/"
}
{
"prop3" "val3"
}
add:
{
"prop4" "val4"
"prop5" "val5"
}

Note that the syntax is not flexible - you must declare each item or token on a separate line as shown above. Each block, denoted between the { and } tokens declares an entity. Each line in the block declares a property of the entity. The properties are two quoted strings per line, separated by a space. The first quote is the key, the second quote is the value. For example, this block describes a hostage:
{
"origin" "1376 3168 -112"
"HostageType" "0"
"angles" "0 111 0"
"classname" "hostage_entity"
}

To add an entity, use the "add:" token. Note that you do not need to specify this token for each block -- it will continue until you use another operation token (such as "filter:"). The example below will add the hostage to the map:
add:
{
"origin" "1376 3168 -112"
"HostageType" "0"
"classname" "hostage_entity"
}

To filter an entity from the map, each entity block contains properties that you wish to match against. For example, the following block will remove any entity that is a hostage:
filter:
{
"classname" "hostage_entity"
}

You can also get very specific, for example, this will only filter out the hostage we added earler:
filter:
{
"origin" "1376 3168 -112"
"HostageType" "0"
"classname" "hostage_entity"
}

Lastly, you can also use regular expressions to match entities. To learn more about regular expressions, visit Perl Regex. These let you define patterns to match against. For example, this will remove any entity that is any type of physics prop:
filter:
{
"classname" "/prop_phys.*/"
}
There are two main configuration files for Stripper:Source. The first is addons/stripper/global_filters.cfg, which is run on every map change. You can also configure per-map files in addons/stripper/maps/.cfg (for example, addons/stripper/maps/de_dust.cfg). These will only be run when that specific map is used.

4. Entity Properties

Unfortunately, I don't know all of the entity properties. So to help users out, you can use the "stripper_dump" console command (requires rcon or server console access). This will dump a file in addons/stripper/dumps named after your map which contains every single entity and all of its properties that the map initializes on load. This file will be roughly 120-200KB and will provide everything you need for stripping/adding entities.

5. Using Stripper:Source from Other Plugins

You can use Stripper:Source from other plugins! Simply download the source code, #include <Stripper.h>, and use engineFactory or ISmmAPI::MetaFactory() to request STRIPPER_INTERFACE (of type IStripper).

Look in IStripper.h for the full interface definition. You can hook when Stripper:Source is about to reparse the map entities and inject your own configuration files.

6. Credits, License, Acknowledgements

This software was made by David "BAILOPAN" Anderson. [ http://www.bailopan.net ]

The idea came from Botman's stripper2 (link in Introduction). I got the initial idea of this plugin from Mani, who discovered that by forcing a new entity string through LevelInit, you could change the map list.

Regular Expressions are implemented with PCRE (Perl Compatible Regular Expression Library). Thanks to Freecode for the screenshots, and PM OnoTo for making SourceHook so awesome.

Stripper:Source is licensed under a slightly modified GPL. Section 9, which allowed you to use a later version of the GPL if available, is removed. If you use Stripper:Source source code in your code or redistribute it, you must redistribute it under the same GNU General Public License.

7. Changelog

2005/12/10 - Initial Release (1.00)