Difference between revisions of "Callbacks"
From ASSS Wiki
Mine GO BOOM (talk | contribs) m (Removing smile) |
m (+cat) |
||
Line 42: | Line 42: | ||
If you find a callback not listed here, if you have more notes on a callback, or would like to correct some info, feel free to edit this page (After all, that is what a wiki is for.) | If you find a callback not listed here, if you have more notes on a callback, or would like to correct some info, feel free to edit this page (After all, that is what a wiki is for.) | ||
+ | |||
+ | [[Category:ASSS]] |
Latest revision as of 13:58, 14 July 2009
This page contains a list of callbacks and arguments for functions. I have tried to format them as well as I can in C. Currently, they are listed in alphabetical order of filenames, but that needs to be changed. Correct parameter names are given. In Python, all variables with "inout" after the type need to be returned from the function. In C you can just ignore it.
- CB_ARENAACTION(Arena *target, int *action): This callback is called whenever the arena is created, changed, destroyed, or configuration files changed. target is the arena being affected, and action is what the arena is doing (AA_*). Gotten from arenaman.h
- CB_BALLPICKUP(Arena *arena, Player *p, int bid): This callback is called whenever a player picks up a ball. arena is the arena it happened in, p is the player who picked up the ball, and bid is the ID of the ball picked up. Gotten from balls.h
- CB_BALLFIRE(Arena *arena, Player *p, int bid): Like the CB_BALLPICKUP command, except this is called when the ball is thrown. arena is the arena it happened in, p is the player who picked up the ball, and bid is the ID of the ball. Gotten from balls.h
- CB_GOAL(Arena *arena, Player *p, int bid, int x, int y): This is called when the ball goes into the goal. arena is the arena it happened in, p is the person who had the ball last, bid is the ID of the ball scored, and x and y is the last position of the ball (PLEASE CONFIRM!). Gotten from balls.h
- CB_SET_BANNER(Player *p, Banner *banner): This is called when a player sets his/her banner. p is the player (Ship will always be SHIP_SPEC), and banner is the banner that has been set. Gotten from banners.h
- CB_CHATMSG(Player *p, int type, int sound, Player *target, int freq, const char *text): Called whenever a player sends a message. p is the player, type is the type of message, which is not just zone, arena, freq, or private (see chat.h), target is the target of a private message, freq is the frequency of a team chat message, and of course, text is the message. Gotten from chat.h
- CB_REWRITECOMMAND(int initial, char *buf, int len): I have no idea what this does, but the file states that "this isn't for general use", so... Gotten from chat.h
- CB_GLOBALCONFIGCHANGED(void): Called when the global configuration file(s) have been changed. The function does not take any parameters. Gotten from config.h
- CB_PLAYERACTION(Player *p, int action, Arena *arena): Called when a player does a miscellaneous function, such as enter an arena. p is the player, action is the action (PA_*, see core.h), and arena is the arena being entered/left, depending on what the player is doing. Gotten from core.h
- CB_TURFTAG(Arena *a, Player *p, int fid, int oldfreq, int newfreq): Called whenever a turf flag is tagged. CB_FLAGONMAP will also run, but this provides more info. a is the arena, p is the player, fid is the flag ID, and old- and newfreq are the old and new frequencies of the flag owners. Gotten from fg_turf.h
- CB_WARZONEWIN(Arena *a, int freq, int *points): Called to figure out the points rewarded from a won warzone-style game. a is the arena, freq is the winning freq, and points is the points rewarded (PLEASE CONFIRM!), and must be incremented. Gotten from fg_wz.h
- CB_FLAGGAIN(Arena *a, Player *p, int fid, int how): Called when a player gains a flag. a is the arena, p is the player that got the flags, fid is the ID of the flag(s) gotten (dunno how it works with multiple flags though), and how is how the player got the flags. Gotten from flagcore.h (see that for "how" values)
- CB_FLAGLOST(Arena *a, Player *p, int fid, int how): The opposite of CB_FLAGGAIN. All parameters are the same, except p is the player that lost the flags. Gotten from flagcore.h
- CB_FLAGONMAP(Arena *a, int fid, int x, int y, int freq): Called when a flag is placed on the map (dropped, neuted, moved, ect). a is the arena, fid is the flag ID, x and y it the position of the flag, and freq is the frequency of the flags. Gotten from flagcore.h
- CB_FLAGRESET(Arena *a, int freq, int points): Called when a flag game is reset, including when it is won. a is the arena, freq is the winning frequency (PLEASE CONFIRM!), and points is the points won (PLEASE CONFIRM!). Gotten from flagcore.h
- CB_KILL(Arena *arena, Player *killer, Player *killed, int bounty, int flags, int inout *pts, int inout *green): Called when a player is killed. arena is the arena, killer is the killer, killed is the killed player, bounty is the bounty displayed in the kill message, flags is the number of flags the killed person was carrying, points is the points the kill is worth, and green is the prize that will be placed after the callback. Gotten from game.h
- CB_KILL_POST_NOTIFY: I guess this is the same as CB_KILL, except it is called AFTER the kill notification is sent. Gotten from game.h
- CB_FREQCHANGE(Player *p, int newfreq): Called when a player changes frequency. p is the player, and newfreq is the frequency the player is changing to. Gotten from game.h
- CB_SHIPCHANGE(Player *p, int newship, int newfreq): Called when a player changes ship. p is player, newship is the SHIP_* of the ship, and newfreq is the new frequency. Gotten from game.h
- CB_TIMESUP(Arena *arena): Called when the game timer is up. arena is the arena. Gotten from game.h
- CB_SAFEZONE(Player *p, int x, int y, int entering): Called when a player enters or leaves a safe zone. From game.h: "be careful about what you do in here; this runs in the unreliable packet handler thread (for now)." p is the player, x and y is the player's position in pixels, and entering is true if the player is entering. Gotten from game.h
- CB_REGION(Player *p, Region *rgn, int x, int y, int entering): Called when a player enters/exits an arena. p is the player, rgn is the region, x and y are the player's position, and entering is true if the player is entering. Gotten from game.h
- CB_GREEN(Player *p, int x, int y, int prize): Called when a player picks up a green. p is the player, x and y is the position of the player (in tiles), and prize is the number of the prize gotten. Gotten from game.h
- CB_ATTACH(Player *p, Player *to): Called when a player attaches to another player. p is the player attaching and to is the player being attached to. Gotten from game.h
- CB_CROWNCHANGE(Player *p, int gain, int cause): Called when a player gains/looses a KOTH crown. p is the player, gain is true if the player is gaining the crown, false if losing, and cause is how the player gained/lost the crown. See the file where the callback was gotten from: koth.h
- CB_KOTH_START(Arena *a, int initial_crowns): Called when a KOTH started. a is the arena, and initial_crowns is the number of players that got crowns (PLEASE CONFIRM!). Gotten from koth.h
- CB_KOTH_END(Arena *a, int playing, int winners, int points_per_winner): Called when a KOTH game ends. It is called before CB_KOTH_PLAYER_WIN a is the arena, playing is the number of players (PLEASE CONFIRM!), winners number of winners (PLEASE CONFIRM!), and points_per_winner is the number of points awarded to each player. Gotten from koth.h
- CB_KOTH_PLAYER_WIN(Arena *a, Player *p, int points): Called for each player that won a KOTR game. a is the arena, p is the player, and points is the points won. Gotten from koth.h
- CB_KOTH_PLAYER_WIN_END(Arena *a): Called after the last CB_KOTH_PLAYER_WIN. a is the arena. Gotten from koth.h
- CB_LOGFUNC(const char *line): Called when a line is logged. line is the line logged. Gotten from logman.h
- CB_MAINLOOP(void): I don't know exactly what this does; Here's the comment: "the type of CB_MAINLOOP callbacks". It does not work with python, and really should not be used. Gotten from mainloop.h
- CB_CONNINIT(struct sockaddr_in *sin, byte *pkt, int len, void *v): I suppose this gets called when a player gets connected. I don't know anything about it, and there is no documentation. Gotten from net.h
- CB_INTERVAL_ENDED(void): Called when an interval that clears persistent data is triggered. Gotten from persist.h
- CB_NEWPLAYER(Player *p, int isnew): Called when a player is allocated or deallocated. p is the player, isnew it true if the player is being allocated, false if being deallocated. Gotten from player.h
- CB_PLAYERDAMAGE(Arena *arena, Player *p, struct S2CWatchDamage *damage, int count): Called when a player takes damage. You need to call AddWatch from I_WATCHDAMAGE before this will take effect (PLEASE CONFIRM!). arena is the arena, p is the player getting hit, and I don't know what damage and count are. Gotten from watchdamage.h
- CB_TURFSTEAL(Arena *arena, Player *p, int fid): I assume that this is called when a frequency claims a turf-flag (PLEASE CONFIRM!). arena is the arena, p is the player claiming the flag, and fid is the Flag ID. Gotten from turf_reward.h
- CB_TURFRECOVER(Arena *arena, int fid, int pid, int freq, int dings, int weight, int recovered): "called when a flag is 'recovered'". I don't exactly know the specifics of this... Gotten from turf_reward.h
- CB_TURFLOST(Arena *arena, int fid, int pid, int freq, int dings, int weight, int recovered): The opposite of CB_TURFRECOVER. Gotten from turf_reward.h
- CB_TURFPOSTREWARD(Arena *arena, struct TurfArena *ta): Called after players have been prized points. arena is the arena, I don't know what ta is. Gotten from turf_reward.h
If you find a callback not listed here, if you have more notes on a callback, or would like to correct some info, feel free to edit this page (After all, that is what a wiki is for.)