Added filter_script

Blixibon 2020-06-18 10:55:27 -05:00
parent a6dfd3c112
commit 465c0b726a

@ -10,11 +10,11 @@ A filter is a type of entity that can test another entity against a certain cond
In Mapbase, all filters have been given the following new I/O/KV:
**Inputs**
* **TestEntity** `<ehandle>` - Tests the filter against the specified entity and fires OnPass or OnFail based on the result. *(TestActivator only uses the activator)*
* **TestEntity** `<ehandle>` - Tests the filter against the specified entity and fires `OnPass` or `OnFail` based on the result. *(TestActivator only uses the activator)*
* **SetField** `<any>` - Sets this filter's primary testing criteria (e.g. the name to test against the activator).
**KeyValues**
* **Pass caller when tested** `<boolean>` - When tested with TestActivator or TestEntity, this causes the OnPass and OnFail outputs to use the entity that called the test as the caller instead of the filter itself.
* **Pass caller when tested** `<boolean>` - When tested with `TestActivator` or `TestEntity`, this causes the `OnPass` and `OnFail` outputs to use the entity that called the test as the caller instead of the filter itself.
---
@ -49,7 +49,7 @@ Here's a list of the redirect filters introduced in Mapbase:
| Name | Description |
|:-------------:|:-------------|
| filter_redirect_weapon | Redirects the activator's weapon. *(as a damage filter, this gets the weapon used in the damage)* |
| filter_redirect_weapon | Redirects the activator's weapon. When used as a damage filter, this gets the weapon used in the damage. |
| filter_redirect_owner | Redirects the activator's owner entity. |
| filter_redirect_inflictor | As a damage filter, this redirects the inflictor of the damage, e.g. the grenade in an explosion. (filters normally use the attacker) |
@ -72,4 +72,24 @@ Here's a list of the redirect filters introduced in Mapbase:
| filter_damage_transfer | Causes damage taken by entities using this filter to transfer to a different entity, or a set of entities. |
| filter_damage_mod | Modifies damage taken by entities using this filter. |
| filter_damage_logic | Fires outputs with damage parameters whenever an entity using this filter takes damage. |
| filter_blood_control | Controls whether blood can be emitted when an entity using this filter takes damage. *(does not affect actual damage on its own)* |
| filter_blood_control | Controls whether blood can be emitted when an entity using this filter takes damage. *(does not affect actual damage on its own)* |
---
### filter_script
<p align="left">
<img src="https://lh3.googleusercontent.com/g5iwtRFv_jmWspvXy6faJgihInlbmvnJFTrFt8q8ofTJ1OPMZ_Zr7Deu0YQ4zBccTGqz6gSXXd-2aeLzktskmv3fRw7V7-8ZewUUr3mRBvBVFzGbXs-LKce5zcvAx-WsDpEPDkAHh3wH5JVfnLSFMhNoFg4MaG9QIfPsKq06VrzWJ3m6wMXGVa0en9eN81iR7Rr89-U9loMveMNullblzTbwHdMO_QYfr5IlNzLzkbeVgAeYUJUMMB6M2q6WS-wY4ENCF1PxCHjifsOF7YDYbNDFy73peZJwH6z9c1SajFyoh7-ei4l3fC5IoWDY7pNJ9Ocd0rGA4JcRj-b5TWwIwAiU9dZsunqiUGnt_uPN1hUW3rs7z4ov0N9XRmfiELIdm82rPeVzztfumWA2ouUIMVAh-DF2_8Qz0bI52udYH71tXe7Q5nRTomI4IYDatZ_9z0EOtnRXi842efEoL4nC8mF2GoRKZ5nwtf8tquKqDm4csI1XHr7vs2HglifEQKiR4vJVrmeLo6CNEVVoWQ47y0Q-PBR_L-G9wEQ12rDET_ii7nB8p1Vl0Oqb7dwQ0E3RaC1oYhUFrfnq6LwhtudAe4Yiqv6IPMtpzNzFePoEZhnXrGdvpJlr3zEESLYnWFr2kTXpRSsRrM55VDdZIEoEwhqcxCHp0rTpqFzji1jipfGvsviV2mKwmjtyVokITlZ4HkGwyg" width="96"/>
</p>
**`filter_script`** is a special filter which allows filter functions to be controlled by VScript. See [[VScript in Mapbase]] for more information on VScript.
Here's a list of the hooks `filter_script` can use:
| Signature | Description |
|:-------------:|:-------------|
| *bool* PassesFilter(handle *caller*, handle *entity*)| Check if the given caller and entity pass the filter. |
| *bool* PassesDamageFilter(handle *caller*, handle *info*)| Check if the given caller and damage info pass the damage filter. |
| *bool* PassesFinalDamageFilter(handle *caller*, handle *info*)| Used by filter_damage_redirect to distinguish between standalone filter calls and actually damaging an entity. Returns true if there's no unique behavior. |
| *bool* BloodAllowed(handle *caller*, handle *info*)| Check if the given caller and damage info allow for the production of blood. |
| *bool* DamageMod(handle *caller*, handle *info*)| Mods the damage info with the given caller. |