mirror of
https://github.com/fortressforever/tfc-reference-data.git
synced 2024-11-14 08:30:58 +00:00
Add pipebomb testing plugin (damage and/or radius)
This commit is contained in:
parent
886b514a2f
commit
3a2a9f57ab
1 changed files with 41 additions and 0 deletions
41
plugins/test_pipe.sma
Normal file
41
plugins/test_pipe.sma
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
#include <amxmodx>
|
||||||
|
#include <engine>
|
||||||
|
|
||||||
|
#define PLUGIN "Test Pipes"
|
||||||
|
#define VERSION "0.1"
|
||||||
|
#define AUTHOR "squeek."
|
||||||
|
|
||||||
|
#define TEST_PIPE_TARGET_CVAR "test_pipe_target"
|
||||||
|
#define TEST_PIPE_RADIUS_CVAR "test_pipe_radius"
|
||||||
|
|
||||||
|
public plugin_init()
|
||||||
|
{
|
||||||
|
register_plugin(PLUGIN, VERSION, AUTHOR)
|
||||||
|
register_think("tf_gl_pipebomb", "gren_think")
|
||||||
|
|
||||||
|
register_cvar(TEST_PIPE_TARGET_CVAR, "1")
|
||||||
|
register_cvar(TEST_PIPE_RADIUS_CVAR, "0")
|
||||||
|
}
|
||||||
|
|
||||||
|
// teleport grenades to the origin of the target
|
||||||
|
public gren_think(gren_id)
|
||||||
|
{
|
||||||
|
if (get_cvar_num(TEST_PIPE_TARGET_CVAR) < 0)
|
||||||
|
return
|
||||||
|
|
||||||
|
teleport_ent_to_ent(gren_id, get_cvar_num(TEST_PIPE_TARGET_CVAR))
|
||||||
|
static Float:zero_velocity[3] = {0.0}
|
||||||
|
entity_set_vector(gren_id, EV_VEC_velocity, zero_velocity)
|
||||||
|
}
|
||||||
|
|
||||||
|
// move entity to the origin of the target
|
||||||
|
public teleport_ent_to_ent(ent_id, target_id)
|
||||||
|
{
|
||||||
|
if (!is_valid_ent(target_id) || !is_valid_ent(ent_id))
|
||||||
|
return
|
||||||
|
|
||||||
|
static Float:target_origin[3]
|
||||||
|
entity_get_vector(target_id, EV_VEC_origin, target_origin)
|
||||||
|
target_origin[0] = target_origin[0] + get_cvar_num(TEST_PIPE_RADIUS_CVAR)
|
||||||
|
entity_set_vector(ent_id, EV_VEC_origin, target_origin)
|
||||||
|
}
|
Loading…
Reference in a new issue