From 2c37c1279afdf674df4064adaee47080bc0ec6b4 Mon Sep 17 00:00:00 2001 From: Bukz Date: Sat, 30 Mar 2013 17:12:34 +0000 Subject: [PATCH] /getmap successfully installed cubescript callback, /dlmap command git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7442 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/docs.cfg | 25 ++++++++++++++++--------- config/scripts.cfg | 1 + source/src/client.cpp | 10 +++++++--- source/src/protos.h | 2 +- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/config/docs.cfg b/config/docs.cfg index cff61bd3..b1e3e33b 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -617,6 +617,11 @@ docremark [The name of the bots will be selected randomly.]; docexample [addnbot 2 CLA bad] [Will add 2 bots with a bad skill level to the CLA team.]; docident [addOnQuit] [Execute a command or block of code on quit.]; docargument [A] [the command or block of code to execute] [min /max /default ]; +docident [addpckserver] [Adds a packages source server where to download custom content from.]; +docargument [S] [The server address. Trailing slash not needed.] [] [0]; +docremark [Only add servers you trust.]; +docremark [The list of servers is saved into config/pcksources.cfg on game quit.]; +docexample [addpckserver http://packages.ac-akimbo.net] []; docident [afterinit] [If defined, this will be executed after saved.cfg is loaded.]; docident [akimboautoswitch] [Enables or disables automatic switching to the akimbo upon pickup.]; docargument [N] [enable or disable] [min 0/max 1/default 1]; @@ -629,6 +634,8 @@ docargument [N] [akimbo end action] [min 0/max 3/default 3]; docremark [If no ammunition is detected for the target weapon, it will fallback to the previous weapon until it finds a weapon with ammunition to use.]; docident [alive] [Returns 1 if the local player is alive.]; docexample [echo (alive)] [Output: 1]; +docident [autodownload] [Determines if the game should try to download missing packages such as textures or mapmodels on the fly.]; +docargument [V] [Note: This is turned on by default.] [min 0/max 1/default 1]; docident [autoreload] [Indicates if the weapons should be reloaded automatically.]; docargument [B] [the autoreload state] [on (1), off (0) min 0/max 1/default 1]; docident [benchme] [Move from active team to spectator during match.]; @@ -712,6 +719,8 @@ docident [demo] [Plays a recorded demo.]; docargument [S] [the demo name] [] [0]; docremark [Playback is interpolated for the player whose perspective you view.]; docident [disconnect] [Leaves a server.]; +docident [dlmap] [Downloads and loads the specified map from an available packages source server.]; +docargument [S] [the name of the map] [] [0]; docident [drawbeamtobots] [Draws a shooting line in the direction of all available bots.]; docargument [] [this command does not take any arguments] [none] [0]; docremark [This is a debugging command and only works for single player modes.]; @@ -741,6 +750,9 @@ docident [getdemo] []; docargument [X] [number in list] [] [0]; docargument [P] [subpath] [] [0]; docident [getmap] [Retrieves the last map that was sent to the server using 'sendmap'.]; +docargument [S] [the name of the map] [] [0]; +docargument [C] [cubescript to execute once map is installed] [] [0]; +docremark [If the command is passed an argument, different than the map being played, the game tries to download the specified map from an available packages source server.]; docident [gndtoggle] [Toggles between your primary weapon and grenades. (must be binded to a key)]; docident [grenades] [Switches to grenades. (if available) (must be binded to a key)]; docident [hasprimary] [Determines if the local player (you) are currently carrying a primary weapon.]; @@ -930,6 +942,8 @@ docident [reconnect] [Disconnects then reconnects you to the current server.]; docargument [P] [the server password] [] [0]; docident [reload] [Reloads the weapon.]; docargument [A] [] [value] [0]; +docident [resetpckservers] [Resets the list of packages source servers where to download custom content from.]; +docremark [The list of servers is saved into config/pcksources.cfg on game quit.]; docident [resetzones] [Reset all drawn zones.]; docident [rewind] [Rewind the current demo to S seconds ago.]; docargument [S] [the number of seconds to rewind] [] [0]; @@ -1050,7 +1064,6 @@ docargument [V] [vertex value] [integer] [0]; docargument [D] [delta value] [integer] [0]; docremark [See config/prefabs.cfg for an example on usage.]; docident [autowp] [Automatically place waypoints.]; -docident [checkmapdependencies] [Find what media the map depends on, this is used for mediapack providers.]; docident [clearents] [Deletes all entities of said type.]; docargument [T] [the entity type, see command 'newent'] [string] [0]; docident [closestenttype] [Restrict 'closest entity' display to one entity type.]; @@ -1131,12 +1144,6 @@ docremark [Heightfields should be made the exact size that is needed, not more n docident [lightscale] [Used to finetune the "overbright lighting" rendering feature when enabled.]; docargument [N] [the brightness of the scene] [min 1/max 100/default 4]; docremark [After changing this value, a "recalc" is needed to see the differences.]; -docident [listmapdependencies] [Prints all media dependencies of a map to a file.]; -docargument [A] [map name] [] [0]; -docremark [The output will be added to the file 'mapdependencies.txt'.]; -docident [listmapdependencies_all] [Prints all media dependencies of all maps to a file.]; -docargument [A] [42] [] [0]; -docremark [The output will be written to the file 'mapdependencies.txt'.]; docident [Map editing] [A variable indicating if the game is in editmode.]; docargument [B] [editmode] [1 (true), 0 (false) read-only]; docident [mapbackupsonsave] [Determines if map backups (.bak) should be created when a map is saved.]; @@ -1295,7 +1302,7 @@ docident [testvisible] []; docargument [D] [direction] [0..5 for Forward, Backward, Left, Right, Up AND Down] [0]; docident [togglebotview] [When used you will see what the bot sees. Type it again (with or without name) to return to the game(you will respawn).]; docargument [N] [botname] [the name of the bot] [0]; -docident [togglegrap] [Will toggle the focus of the mouse in game. Normally you can use your mouse to look around, when you type this command your mouse cursor is visible and can be used as normally. This is only useful when you run cube windowed, of course.]; +docident [togglegrab] [Will toggle the focus of the mouse in game. Normally you can use your mouse to look around, when you type this command your mouse cursor is visible and can be used as normally. This is only useful when you run cube windowed.]; docident [toggleocull] [Turns occlusion culling on and off.]; docremark [The reason one may want to turn it off is to get an overview of the map from above, without having all occluded bits stripped out.]; docident [undo] [Multi-level undo of any of the changes caused by editing operations]; @@ -2012,7 +2019,7 @@ docremark [Binds the texture indicated in the filename to the texture slot of an docexample [loadnotexture // Reset to default] []; docexample [loadnotexture "makke/black.jpg" // Any missing texture will show up black] []; docident [loadsky] [Loads a skymap for a map.]; -docargument [P] [path to the six skybox textures] [string] [0]; +docargument [P] [path to the six skymap textures] [string] [0]; docremark [The available skymaps reside in packages/textures/skymaps/..]; docremark [To select a skymap you need to use the full path from "packages/" but only up to the underscore "_" in the filename.]; docexample [loadsky "textures/skymaps/makke/mountain"] []; diff --git a/config/scripts.cfg b/config/scripts.cfg index 6de72653..40854333 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -269,6 +269,7 @@ const quickanswer [ if (>= $lastpm 0) [ saycommand (concat /pm $lastpm []) ] [ s // For those players who use IRC too much... const join [ connect $arg1 $arg2 $arg3 ] const reconnect [ if $numargs [ svpass = $arg1 ] [ svpass = [] ]; if $connected [ svdata = (curserver); afterdisconnect [ connect (at $svdata 0) (at $svdata 1) $svpass ] ] ] +const dlmap [ getmap $arg1 [ map $arg1 ] ] const rndmap [ result (at $defaultmaps (rnd (listlen $defaultmaps))) ] const rrnd [ + (rnd (- $arg2 $arg1)) $arg1 ] const ++ [ if (checkalias $arg1) [ += $arg1 1 ] ] diff --git a/source/src/client.cpp b/source/src/client.cpp index 3f38da60..0654c35f 100644 --- a/source/src/client.cpp +++ b/source/src/client.cpp @@ -786,7 +786,7 @@ void sendmap(char *mapname) conoutf(_("sending map %s to server..."), mapname); } -void getmap(char *name) +void getmap(char *name, char *callback) { if((!name || !*name) || (connected && !strcmp(name, getclientmap())) ) @@ -800,7 +800,11 @@ void getmap(char *name) { defformatstring(package)("packages/maps/%s.cgz", name); requirepackage(PCK_MAP, package); - if(downloadpackages()) conoutf("map %s installed successfully", name); + if(downloadpackages()) + { + if(callback && *callback) execute(callback); + conoutf("map %s installed successfully", name); + } else conoutf("\f3map download failed."); } } @@ -862,7 +866,7 @@ void rewinddemo(int *seconds) } COMMAND(sendmap, "s"); -COMMAND(getmap, "s"); +COMMAND(getmap, "ss"); COMMAND(deleteservermap, "s"); COMMAND(resetsecuremaps, ""); COMMAND(securemap, "s"); diff --git a/source/src/protos.h b/source/src/protos.h index 603f7847..9fc3445e 100644 --- a/source/src/protos.h +++ b/source/src/protos.h @@ -376,7 +376,7 @@ extern void c2skeepalive(); extern void neterr(const char *s); extern int getclientnum(); extern void changeteam(int team, bool respawn = true); // deprecated? -extern void getmap(char *name = NULL); +extern void getmap(char *name = NULL, char *callback = NULL); extern void newteam(char *name); extern bool securemapcheck(const char *map, bool msg = true); extern int getbuildtype();