/*
 * ============================================================================
 *
 *  Zombie:Reloaded
 *
 *  File:          zrtools.inc
 *  Type:          Include
 *  Description:   API for ZR Tools.
 *
 *  Copyright (C) 2009  Greyscale
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * ============================================================================
 */

#if defined _zrtools_included
  #endinput
#endif
#define _zrtools_included

/**
 * Specifies what to do after a hook completes.
 */
enum ZRTools_Action
{
	ZRTools_Continue = 0, /**< Continue with the original action */
	ZRTools_Changed = 1, /**< Inputs or outputs have been overridden with new values */
	ZRTools_Handled = 2, /**< Handle the action at the end (don't call it) */
};

/**
 * Callback function for TraceAttack.
 * 
 * @param client        The client index.
 * @param inflictor     The entity index of the inflictor.
 * @param attacker      The client index of the attacker.
 * @param damage        The amount of damage inflicted.
 * @param hitbox        The hitbox index.
 * @param hitgroup      The hitgroup index.
 * @return              Return ZRTools_Handled to stop bullet from hitting client.
 *                      ZRTools_Continue to allow bullet to hit client.
 */
functag public ZRTools_Action:ZRTools_TraceAttack(client, inflictor, attacker, Float:damage, hitbox, hitgroup);

/**
 * Hooks TraceAttack on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookTraceAttack(client, ZRTools_TraceAttack:callback);

/**
 * Unhooks TraceAttack on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookTraceAttack(hookid);

// instant damage

#define DMG_GENERIC			0			// generic damage was done
#define DMG_CRUSH			(1 << 0)	// crushed by falling or moving object. 
										// NOTE: It's assumed crush damage is occurring as a result of physics collision, so no extra physics force is generated by crush damage.
										// DON'T use DMG_CRUSH when damaging entities unless it's the result of a physics collision. You probably want DMG_CLUB instead.
#define DMG_BULLET			(1 << 1)	// shot
#define DMG_SLASH			(1 << 2)	// cut, clawed, stabbed
#define DMG_BURN			(1 << 3)	// heat burned
#define DMG_VEHICLE			(1 << 4)	// hit by a vehicle
#define DMG_FALL			(1 << 5)	// fell too far
#define DMG_BLAST			(1 << 6)	// explosive blast damage
#define DMG_CLUB			(1 << 7)	// crowbar, punch, headbutt
#define DMG_SHOCK			(1 << 8)	// electric shock
#define DMG_SONIC			(1 << 9)	// sound pulse shockwave
#define DMG_ENERGYBEAM		(1 << 10)	// laser or other high energy beam 
#define DMG_PREVENT_PHYSICS_FORCE		(1 << 11)	// Prevent a physics force 
#define DMG_NEVERGIB		(1 << 12)	// with this bit OR'd in, no damage type will be able to gib victims upon death
#define DMG_ALWAYSGIB		(1 << 13)	// with this bit OR'd in, any damage type can be made to gib victims upon death.
#define DMG_DROWN			(1 << 14)	// Drowning

// time-based damage
#define DMG_TIMEBASED		(DMG_PARALYZE | DMG_NERVEGAS | DMG_POISON | DMG_RADIATION | DMG_DROWNRECOVER | DMG_ACID | DMG_SLOWBURN)	// mask for time-based damage

#define DMG_PARALYZE		(1 << 15)	// slows affected creature down
#define DMG_NERVEGAS		(1 << 16)	// nerve toxins, very bad
#define DMG_POISON			(1 << 17)	// blood poisoning - heals over time like drowning damage
#define DMG_RADIATION		(1 << 18)	// radiation exposure
#define DMG_DROWNRECOVER	(1 << 19)	// drowning recovery
#define DMG_ACID			(1 << 20)	// toxic chemicals or acid burns
#define DMG_SLOWBURN		(1 << 21)	// in an oven

#define DMG_REMOVENORAGDOLL	(1<<22)		// with this bit OR'd in, no ragdoll will be created, and the target will be quietly removed.
										// use this to kill an entity that you've already got a server-side ragdoll for

#define DMG_PHYSGUN			(1<<23)		// Hit by manipulator. Usually doesn't do any damage.
#define DMG_PLASMA			(1<<24)		// Shot by Cremator
#define DMG_AIRBOAT			(1<<25)		// Hit by the airboat's gun

#define DMG_DISSOLVE		(1<<26)		// Dissolving!
#define DMG_BLAST_SURFACE	(1<<27)		// A blast on the surface of water that cannot harm things underwater
#define DMG_DIRECT			(1<<28)
#define DMG_BUCKSHOT		(1<<29)		// not quite a bullet. Little, rounder, different.

// CS:S Specific damage flags. (should probably use these)
#define DMG_CSS_FALL        (DMG_FALL)      // Client was damaged by falling.
#define DMG_CSS_BLAST       (DMG_BLAST)     // Client was damaged by explosion.
#define DMG_CSS_BURN        (DMG_DIRECT)    // Client was damaged by fire.
#define DMG_CSS_BULLET      (DMG_NEVERGIB)  // Client was shot or knifed.
#define DMG_CSS_HEADSHOT    (1 << 30)       // Client was shot in the head.

/**
 * Callback function for OnTakeDamage.
 * 
 * @param client        The client index.
 * @param inflictor     The entity index of the inflictor.
 * @param attacker      The client index of the attacker.
 * @param damage        The amount of damage inflicted.
 * @param damagetype    The type of damage inflicted.
 * @param ammotype      The ammo type of the attacker's weapon. 
 * @return              Return ZRTools_Handled to stop the damage to client.
 *                      ZRTools_Continue to allow damage to client.
 */
functag public ZRTools_Action:ZRTools_OnTakeDamage(client, inflictor, attacker, Float:damage, damagetype, ammotype);

/**
 * Hooks OnTakeDamage on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookOnTakeDamage(client, ZRTools_OnTakeDamage:callback);

/**
 * Unhooks OnTakeDamage on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookOnTakeDamage(hookid);

/**
 * Callback function for StartTouch.
 * 
 * @param client        The client index.
 * @param entity        The entity index of the entity being touched.
 */
functag public ZRTools_Action:ZRTools_StartTouch(client, entity);

/**
 * Hooks StartTouch on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookStartTouch(client, ZRTools_StartTouch:callback);

/**
 * Unhooks StartTouch on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookStartTouch(hookid);

/**
 * Callback function for Touch.
 * 
 * @param client        The client index.
 * @param entity        The entity index of the entity being touched.
 */
functag public ZRTools_Action:ZRTools_Touch(client, entity);

/**
 * Hooks Touch on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookTouch(client, ZRTools_Touch:callback);

/**
 * Unhooks Touch on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookTouch(hookid);

/**
 * Callback function for EndTouch.
 * 
 * @param client        The client index.
 * @param entity        The entity index of the entity being touched.
 */
functag public ZRTools_Action:ZRTools_EndTouch(client, entity);

/**
 * Hooks EndTouch on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookEndTouch(client, ZRTools_EndTouch:callback);

/**
 * Unhooks EndTouch on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookEndTouch(hookid);

/**
 * Callback function for Weapon_CanUse.
 * Called when a client attempts to pick up a weapon. 
 * 
 * @param client    The client index.
 * @param weapon    The weapon index.
 * @return          Return ZRTools_Handled to stop weapon pickup.
 *                  ZRTools_Continue to allow weapon pickup.
 */
functag public ZRTools_Action:ZRTools_Weapon_CanUse(client, weapon);

/**
 * Hooks Weapon_CanUse on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookWeapon_CanUse(client, ZRTools_Weapon_CanUse:callback);

/**
 * Unhooks Weapon_CanUse on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID.
 */
native ZRTools_UnhookWeapon_CanUse(hookid);

/**
 * Callback function for Weapon_Drop.
 * Called when a client drops their weapon. 
 * 
 * @param client    The client index.
 * @param weapon    The weapon index.
 */
functag public ZRTools_Action:ZRTools_Weapon_Drop(client, weapon);

/**
 * Hooks Weapon_Drop on a client.
 * 
 * @param client    The client index.
 * @param callback  The callback function for hook.
 * @return          The unique HookID.
 */
native ZRTools_HookWeapon_Drop(client, ZRTools_Weapon_Drop:callback);

/**
 * Unhooks Weapon_Drop on a client.
 * 
 * @param hookid    The HookID of the hook.
 * @error           Invalid HookID. 
 */
native ZRTools_UnhookWeapon_Drop(hookid);

/**
 * Do not edit below this line!
 */
public Extension:__ext_zrtools = 
{
	name = "ZR Tools",
	file = "zrtools.ext",
	autoload = 1,
#if defined REQUIRE_EXTENSIONS
	required = 1,
#else
	required = 0,
#endif
};