// The olds.ro American Football core interface used by the add-on plugins.
// Copyright (C) 2026 daemon (olds.ro). SPDX-License-Identifier: GPL-3.0-or-later
//
// The football core fires the forwards (CreateMultiForward, ET_IGNORE) and provides the
// natives in the library "olds_afootball". Add-ons define the forwards they need as public
// functions; an add-on that calls the natives should use a native filter so it also loads
// without the core. A core with other names can be connected through a small bridge plugin.
#if defined _olds_afootball_included
#endinput
#endif
#define _olds_afootball_included
/**
* A kickoff: the ball is kicked to the receiving team.
*
* @param receiving_team 1 = Terrorists, 2 = Counter-Terrorists
*/
forward olds_af_kickoff(receiving_team);
/**
* A player caught the kickoff and starts the return.
*/
forward olds_af_catch(id);
/**
* The returner was tackled (or the return play is over).
*/
forward olds_af_tackle(id);
/**
* The ball is spotted for the next play: the line of scrimmage is set and the pre-snap
* phase begins.
*
* @param axis 0 = the field runs along x, 1 = along y
* @param line the line of scrimmage on that axis
* @param t_side 1 when the Terrorists line up at coordinates above the line (the
* Counter-Terrorists below it), -1 the other way round
*/
forward olds_af_ball_spot(axis, Float:line, t_side);
/**
* The ball is snapped: the pre-snap phase is over.
*/
forward olds_af_snap();
/**
* Half-time.
*/
forward olds_af_halftime();
/**
* Moves the ball spot a number of yards toward a team's own end zone (a penalty against
* that team).
*
* @param team 1 = Terrorists, 2 = Counter-Terrorists
* @param yards yards to move
* @noreturn
*/
native olds_af_move_spot(team, yards);
/**
* Whistles the play dead.
*
* @param reason a short reason for the core's log and messages
* @noreturn
*/
native olds_af_whistle(const reason[]);
/**
* The player who carries the ball.
*
* @return player index, or 0 when nobody carries it
*/
native olds_af_get_carrier();
/**
* The ball entity.
*
* @return entity index, or 0 when there is no ball
*/
native olds_af_get_ball();
/**
* Makes the carrier drop the ball where he stands, as the core does on death; the
* caller may then change the ball's velocity.
*
* @return the ball entity, or 0 when nobody carried it
*/
native olds_af_drop_ball();
/**
* Gives the ball to a player (a caught pass): he becomes the carrier.
*
* @param id the player
* @return 1 on success, 0 when the player cannot carry it
*/
native olds_af_set_carrier(id);
/**
* A player is about to pick up the loose ball (ET_STOP).
*
* @param id the player
* @param ball the ball entity
* @return PLUGIN_HANDLED to refuse the pick-up, PLUGIN_CONTINUE to allow it
*/
forward olds_af_ball_pickup(id, ball);