Update extra AMXX plugins.
This commit is contained in:
@@ -12,14 +12,18 @@ All plugins in this section require AMXX 1.9.0 or greater, they will not work on
|
||||
|
||||
Compiled plugins are provided in the `bin` folder for your convenience. However, if you prefer to build the plugins yourself, the source code of all AMXX plugins are located in the `src` folder for compilation.
|
||||
|
||||
#### GoldSrc --> MonsterMod Use Dispatcher
|
||||
#### Use Dispatcher
|
||||
|
||||
Because MonsterMod entities are, -quite literally-, just a func_wall with its own logic, trying to trigger any MonsterMod entity from the outside will fail, as it will attempt to use the logic of game's "func_wall" instead of our own.
|
||||
|
||||
To add salt to injury, Metamod is incapable of hooking use functions, as the pfnUse/DispatchUse methods provided by the API has been deprecated, and no longer work. Leaving AMXX's HamSandwich as the only module that can hook an entity's Use() function.
|
||||
|
||||
In normal circunstances, you do not need this plugin. But let's say you have a turret monster, disabled by default, and you gave it a targetname. Even with a name, triggering this turret regardless of the method used will not activate it.
|
||||
|
||||
This plugin redirects the game's func_wall Use() function to MonsterMod, connecting the missing piece and allowing you to trigger MonsterMod entities with your shiny func_button.
|
||||
The same problem occurs from the other side, a MonsterMod entity trying to trigger something will expect said entity to be part of MonsterMod as well.
|
||||
|
||||
I can't believe I've done this. *incomprehensible screams*
|
||||
This plugin redirects the game's func_wall Use() function to MonsterMod, as well as bridging Use() calls from MonsterMod back to the game, connecting the missing pieces and allowing you to trigger MonsterMod entities from the game, and game entities from MonsterMod.
|
||||
|
||||
#### External TakeDamage
|
||||
|
||||
When a MonsterMod entity tries to inflict damage to something, it expects said entity to be either a player or a MonsterMod monster. If something else is to be found, it will deal no damage to it, as it doesn't know how to manage it.
|
||||
|
||||
This plugin allows MonsterMod entities to inflict damage to normal game entities, such as breakables.
|
||||
|
||||
BIN
extra/base/bin/glb_takedamage.amxx
Normal file
BIN
extra/base/bin/glb_takedamage.amxx
Normal file
Binary file not shown.
@@ -6,9 +6,15 @@
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin( "GAME-MONSTER: Use Dispatcher", "1.0", "Giegue" );
|
||||
register_plugin( "GAME-MONSTER: Use Dispatcher", "1.1", "Giegue" );
|
||||
|
||||
register_cvar( "_glb_use", "1" );
|
||||
|
||||
// Game --> MonsterMod
|
||||
RegisterHam( Ham_Use, "func_wall", "DispatchUse" );
|
||||
|
||||
// MonsterMod --> Game
|
||||
register_srvcmd( "_trigger", "FireTargets" );
|
||||
}
|
||||
|
||||
public DispatchUse( entity, caller, activator, useType, Float:value )
|
||||
@@ -22,3 +28,30 @@ public DispatchUse( entity, caller, activator, useType, Float:value )
|
||||
|
||||
return HAM_IGNORED;
|
||||
}
|
||||
|
||||
public FireTargets()
|
||||
{
|
||||
if ( read_argc() == 6 )
|
||||
{
|
||||
new entity, caller, activator;
|
||||
new Float:value;
|
||||
new useType;
|
||||
|
||||
entity = read_argv_int( 1 );
|
||||
caller = read_argv_int( 2 );
|
||||
activator = read_argv_int( 3 );
|
||||
value = read_argv_float( 4 );
|
||||
useType = read_argv_int( 5 );
|
||||
|
||||
// caller and activator can be null, but never allow entity to be null
|
||||
if ( !is_valid_ent( entity ) )
|
||||
return;
|
||||
|
||||
if ( !is_valid_ent( caller ) )
|
||||
caller = 0;
|
||||
if ( !is_valid_ent( activator ) )
|
||||
activator = 0;
|
||||
|
||||
ExecuteHamB( Ham_Use, entity, caller, activator, useType, value );
|
||||
}
|
||||
}
|
||||
|
||||
42
extra/base/src/glb_takedamage.sma
Normal file
42
extra/base/src/glb_takedamage.sma
Normal file
@@ -0,0 +1,42 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <amxmodx>
|
||||
#include <engine>
|
||||
#include <hamsandwich>
|
||||
|
||||
public plugin_init()
|
||||
{
|
||||
register_plugin( "GAME-MONSTER: External TakeDamage", "1.0", "Giegue" );
|
||||
|
||||
register_cvar( "_glb_takedamage", "1" );
|
||||
|
||||
// MonsterMod --> Game
|
||||
register_srvcmd( "_takedamage", "TakeDamage" );
|
||||
}
|
||||
|
||||
public TakeDamage()
|
||||
{
|
||||
if ( read_argc() == 6 )
|
||||
{
|
||||
new victim, inflictor, attacker;
|
||||
new Float:damage;
|
||||
new damageBits;
|
||||
|
||||
victim = read_argv_int( 1 );
|
||||
inflictor = read_argv_int( 2 );
|
||||
attacker = read_argv_int( 3 );
|
||||
damage = read_argv_float( 4 );
|
||||
damageBits = read_argv_int( 5 );
|
||||
|
||||
// attacker and inflictor can be null, but never allow victim to be null
|
||||
if ( !is_valid_ent( victim ) )
|
||||
return;
|
||||
|
||||
if ( !is_valid_ent( inflictor ) )
|
||||
inflictor = 0;
|
||||
if ( !is_valid_ent( attacker ) )
|
||||
attacker = 0;
|
||||
|
||||
ExecuteHamB( Ham_TakeDamage, victim, inflictor, attacker, damage, damageBits );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user