155 lines
4.5 KiB
SourcePawn
155 lines
4.5 KiB
SourcePawn
#if defined _Couch_included
|
|
#endinput
|
|
#endif
|
|
|
|
#define _Couch_included
|
|
|
|
// The core defines COUCH_CORE; it creates the forwards and natives itself.
|
|
#if !defined COUCH_CORE
|
|
|
|
/**
|
|
* Called after the couch has been created, for admin spawns and round-start respawns.
|
|
*
|
|
* @param couch Entity index of the new couch.
|
|
*/
|
|
forward void Couch_OnCouchSpawned(int couch);
|
|
|
|
/**
|
|
* Called once the couch entity is gone, for whatever reason. Couch_IsPlaced() tells whether
|
|
* it will come back at the next round start.
|
|
*/
|
|
forward void Couch_OnCouchRemoved();
|
|
|
|
/**
|
|
* Called for every hit the couch accepts from a player. Shotguns report once per pellet.
|
|
*
|
|
* @param couch Entity index of the couch.
|
|
* @param attacker Client index of the player who dealt the damage.
|
|
* @param damage Damage dealt by this hit.
|
|
*/
|
|
forward void Couch_OnCouchDamaged(int couch, int attacker, float damage);
|
|
|
|
/**
|
|
* Called when a hit from a blocked client is refused. Fires per pellet, so rate-limit anything you send.
|
|
*
|
|
* @param couch Entity index of the couch.
|
|
* @param client Client index of the blocked player.
|
|
*/
|
|
forward void Couch_OnClientBlocked(int couch, int client);
|
|
|
|
/**
|
|
* @return Entity index of the couch, or -1 if there is none.
|
|
*/
|
|
native int Couch_GetCouch();
|
|
|
|
/**
|
|
* Whether an admin has placed a couch this map. While true the couch respawns at the placed
|
|
* spot every round start.
|
|
*
|
|
* @return True if a placement is remembered.
|
|
*/
|
|
native bool Couch_IsPlaced();
|
|
|
|
/**
|
|
* Spawns the couch where the client is aiming, replacing any existing couch. The spot becomes
|
|
* the respawn point.
|
|
*
|
|
* @param client Client whose crosshair places the couch. Must be in game.
|
|
* @return Entity index of the couch, or -1 on failure.
|
|
*/
|
|
native int Couch_Spawn(int client);
|
|
|
|
/**
|
|
* Teleports the couch to where the client is aiming. The respawn point is left as it was.
|
|
*
|
|
* @param client Client whose crosshair places the couch. Must be in game.
|
|
* @return True on success, false if there is no couch.
|
|
*/
|
|
native bool Couch_Bring(int client);
|
|
|
|
/**
|
|
* Teleports the client onto the couch, or beside it when the top is blocked. The client keeps
|
|
* their view angles and arrives with no velocity.
|
|
*
|
|
* @param client Client to teleport. Must be in game.
|
|
* @return True on success, false if there is no couch.
|
|
*/
|
|
native bool Couch_Goto(int client);
|
|
|
|
/**
|
|
* Removes the couch and forgets its placement.
|
|
*
|
|
* @return True if a couch or a placement was removed.
|
|
*/
|
|
native bool Couch_Remove();
|
|
|
|
/**
|
|
* Whether the colour cycle and light are on. Mirrors sm_couch_effect.
|
|
*/
|
|
native bool Couch_IsEffectEnabled();
|
|
|
|
/**
|
|
* Switches the colour cycle and light on or off. Writes sm_couch_effect.
|
|
*/
|
|
native void Couch_SetEffectEnabled(bool enabled);
|
|
|
|
/**
|
|
* Whether only pistols and knives may move the couch. Mirrors sm_couch_pistol_only.
|
|
*/
|
|
native bool Couch_IsPistolOnly();
|
|
|
|
/**
|
|
* Restricts couch movement to pistols and knives, or lifts the restriction. Writes sm_couch_pistol_only.
|
|
*/
|
|
native void Couch_SetPistolOnly(bool enabled);
|
|
|
|
/**
|
|
* Blocks or unblocks a client from the couch: their hits are refused and their body can't push
|
|
* it. The flag is per slot and cleared on disconnect and map start; the caller owns persistence.
|
|
*
|
|
* @param client Client to block or unblock. Must be in game.
|
|
* @param blocked True to block, false to lift the block.
|
|
*/
|
|
native void Couch_SetClientBlocked(int client, bool blocked);
|
|
|
|
/**
|
|
* Whether the client is currently blocked from the couch.
|
|
*
|
|
* @param client Client index.
|
|
* @return True if blocked.
|
|
*/
|
|
native bool Couch_IsClientBlocked(int client);
|
|
|
|
|
|
public SharedPlugin __pl_Couch =
|
|
{
|
|
name = "Couch",
|
|
file = "Couch.smx",
|
|
|
|
#if defined REQUIRE_PLUGIN
|
|
required = 1
|
|
#else
|
|
required = 0
|
|
#endif
|
|
};
|
|
|
|
#if !defined REQUIRE_PLUGIN
|
|
public void __pl_Couch_SetNTVOptional()
|
|
{
|
|
MarkNativeAsOptional("Couch_GetCouch");
|
|
MarkNativeAsOptional("Couch_IsPlaced");
|
|
MarkNativeAsOptional("Couch_Spawn");
|
|
MarkNativeAsOptional("Couch_Bring");
|
|
MarkNativeAsOptional("Couch_Goto");
|
|
MarkNativeAsOptional("Couch_Remove");
|
|
MarkNativeAsOptional("Couch_IsEffectEnabled");
|
|
MarkNativeAsOptional("Couch_SetEffectEnabled");
|
|
MarkNativeAsOptional("Couch_IsPistolOnly");
|
|
MarkNativeAsOptional("Couch_SetPistolOnly");
|
|
MarkNativeAsOptional("Couch_SetClientBlocked");
|
|
MarkNativeAsOptional("Couch_IsClientBlocked");
|
|
}
|
|
#endif
|
|
|
|
#endif // COUCH_CORE
|