Class: mapSize

mapSize()

Demonstration code for wall placement. Some notes/reminders: - All angles (orientation) are in radians. - When looking at the map, with the x-axis being horizontal and the y-axis vertical: -- The origin point (0,0) of the map is in the bottom-left corner, -- A wall orientated at 0 has its "outside" facing right and its "inside" facing left. -- A wall orientated at Pi is reversed (obviously). -- A wall orientated at Pi/2 has its "outside" facing down and its "inside" facing up. - As a general rule, walls are drawn in a anti-clockwise direction. Some general notes concerning the arguments: - The first two arguments for most placement functions are x/y co-ordinates needed to position the wall. These are received via separate arguments, like in placeEntityPassable and their exact meaning differs between methods, but should be mostly self explanatory. The exception to this is placeLinearWall(), where the first four arguments are co-ordinates. However, whether two argument or four, the initial x/y co-ordinates are required parameters. - For some functions, the next argument is radius, indicating how far from a central point the wall should be drawn. The functions that use this are marked as doing so below. - The next argument is usually an array containing wall element type strings. (See the block comment for getWallElement() for a list of accepted type strings.) The exception to this is placeFortress(), which accepts a string here instead, identifying which of the predefined fortresses designs you wish to use. (See the example provided below for details.) Most functions will ask that you do not include "bending" wall elements in your array ("cornerIn", "cornerOut", "turn_{x}") and will complain if you attempt to do so. The ones that do this are clearly marked below. The array will generally look like: ["start", "medium", "tower", "gate", "tower", "medium", "end"] Remember that walls are drawn in an anti-clockwise direction. Thus, when looking at a wall element in-game, with the "outside" facing up, then the *next* wall element will be drawn to the left of *this* element. This argument is optional, and each function has a different default value. - The next argument is a string denoting the style of the wall. These are derived from the names of wallsets defined in 0ad: for example "athen_wallset_stone" becomes "athen_stone", and "rome_wallset_siege" becomes "rome_siege". (A full list can be found stored as the keys of the global constant g_WallStyles.) This argument is optional, and if not set, the civ's basic stone wallset will be used. - The next argument is the player-id of the player that is to own the wall. This argument is optional, and defaults to 0 (gaia). - The next argument is an angle defining the angle of orientation of the wall. The exact use differs slightly between functions, but hopefully the comments on the examples below should help. Also see the notes above about wall orientation. This argument is optional, and defaults to 0. - Any remaining arguments differ from function to function, but are all optional. Please read the comments below, and also the block comment of the function in wall_builder.js for further details. And have fun!