share/hedgewars/Data/Scripts/Multiplayer/WxW.lua
author Wuzzy <Wuzzy2@mail.ru>
Mon, 08 Apr 2019 19:02:01 +0200
changeset 14793 f5dcf47dff2c
parent 14792 97a36fb44123
child 14794 a9f32ff53389
permissions -rw-r--r--
WxW: Don't register wall touch if not gstHHDriven
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     2
----------------------
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
     3
-- WALL TO WALL 0.7
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     4
----------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     5
-- a shoppa minigame
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     6
-- by mikade
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     7
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
     8
-- feel free to add map specific walls to LoadConfig, or post additional
13512
36f3f77e9b1b Switch from http:// to https:// URLs where possible
Wuzzy <Wuzzy2@mail.ru>
parents: 13468
diff changeset
     9
-- wall suggestions on our forum at: https://www.hedgewars.org/forum
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    10
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    11
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    12
--0.1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    13
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    14
-- concept test
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    15
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    16
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    17
--0.2
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    18
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    19
-- unhardcoded turntimeleft, now uses shoppa default of 45s
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    20
-- changed some things behind the scenes
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    21
-- fixed oooooold radar bug
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    22
-- added radar / script support for multiple crates
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    23
-- tweaked weapons tables
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    24
-- added surfing and changed crate spawn requirements a bit
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    25
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    26
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    27
--0.3
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    28
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    29
-- stuffed dirty clothes into cupboard
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    30
-- improved user feedback
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    31
-- added/improved experimental config system, input masks included :D
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    32
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    33
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    34
--0.4
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    35
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    36
-- for version 0.9.18, now detects border in correct location
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    37
-- fix 0.3 config constraint
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    38
-- remove unnecessary vars
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    39
-- oops, remove hardcoding of minesnum,explosives
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    40
-- ... and unhardcode turntime (again)... man, 30s is hard :(
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    41
-- move some initialisations around
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    42
-- numerous improvements to user feedback
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    43
-- walls disappear after being touched
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    44
-- added backwards compatibility with 0.9.17
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    45
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    46
----------------
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    47
--0.5
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    48
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    49
-- Support for multiple sets of walls per map (instead of “all or nothing”)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    50
-- Ropes, ShoppaKing, ShoppaHell and ShoppaNeon can now be played with the classic left and right walls
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    51
-- New wall sets for Ropes, ShoppaNeon, ShoppaDesert, ShoppaWild, ShoppaKing and ShoppaHell, and more.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    52
-- Basic support for a bunch of Shoppa maps
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    53
-- Alternative configuration method with Script parameter
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    54
-- Possible to set max. number of weapons in game (script parameter only)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    55
-- Possible to set number of crates per turn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    56
-- Menu can be disabled (with script parameter) for insant game start
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    57
-- WxW is now fully functional even without a map border.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    58
-- WxW now allows for almost all game modifiers and game settings to be changed
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    59
-- More sound effects
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    60
-- No smoke when hog is near near a WxW wall but Walls Before Crate rule is not in place
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    61
-- More readable mission display after configuration has been accepted
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    62
-- Hide “Surf Before Crate” setting if surfing is disabled for this map, or the bottom is active and water never rises
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    63
-- Hide walls setting if script does not provide walls for map yet
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    64
-- Bugfix: Other player was able to change the menu config in the short period before the first "turn"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    65
-- Lots of refactoring
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    66
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    67
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    68
--0.6
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    69
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    70
-- Bugfix: 2 crates spawned at the 1st turn if script parameter was set to “menu=false, walls=none” or similar
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    71
-- Bugfix: Annoying faulty error message appeared when hitting attack when on a rope with a weapon selected
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    72
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    73
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    74
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    75
--0.7
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    76
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    77
-- To enforce the rules more strictly, all crates will be frozen at turn start if WBC or SBC rule is in place.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    78
--	The crates are unfrozen if you met the crate criteria (that is, surfed and/or bounced off all walls).
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    79
--      Frozen crates can't be collected and appear as small white dots in the radar.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    80
-- Add support for the “Crate Before Attack” rule
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    81
-- Add support for the “All But Last” rule
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    82
-- Add support for the “Kill The Leader” rule
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    83
-- Allow toggling crate radar with “switch hog” key while roping
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    84
-- The game continues now with the first team after the menu has been closed (rather than the second team)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    85
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    86
----------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    87
--TODO
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    88
----------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    89
-- achievements / try detect shoppa moves? :|
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    90
-- maybe add ability for the user to place zones like in Racer?
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    91
-- add more hard-coded values for specific maps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
    92
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    93
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    94
--[[
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    95
# CONFIGURATION
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    96
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    97
By default, this script is easily configured via the in-game menu. The player of the first team can choose the rules and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    98
required walls (or none at all). After accepted, the game will start with the second team (!).
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
    99
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   100
= SCRIPT PARAMETER =
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   101
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   102
Using the script parameter is optional, it mostly is just an alternative way for configuration and for convenience
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   103
reasons, so often-used configurations can be saved and loaded.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   104
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   105
The script parameter is specified as a comma-sperated list of “key=value” pairs (see examples below).
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   106
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   107
Truth values can be set true or false, and numeric values always use a whole number.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   108
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   109
== Basic parameters ==
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   110
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   111
key		default	description
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   112
----------------------------------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   113
menu		true	Show configuration menu at the beginning. If no menu is used, a random wall set is used (see wall filters below)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   114
SBC		false	Surf Before Crate: Player must bounce off the water (“surfing”) before crates can be collected
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   115
AFR		false	Attack From Rope: Players must attack from the rope. Weapons which can't be fired from rope are removed
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   116
CBA		false	Crate Before Attack: Player must collect at least one crate before attacking
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   117
attackrule	off	If present, enable one of the attack rules “ABL” or “KTL”:
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   118
			ABL: All But Last: Players must not only attack the team with the lowest total health
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   119
			KTL: Kill The Leader: If players hit some enemy hedgehog, at least one of them must be a hog from
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   120
			the team with the highest total health.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   121
			The ABL and KTL rules exclude each other. If a player breaks the rule (if enabled), he must
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   122
			skip in the next round.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   123
SW		false	Super Weapons: A few crates may contain very powerful weapons (melon, hellish grenade, RC plane, ballgun)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   124
maxcrates	12	Number of crates which can be at maximum in the game (limited to up to 100 to avoid lag)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   125
cratesperturn	1	Number of crates which appear each turn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   126
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   127
== Advanced parameters ==
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   128
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   129
Wall filters: The following parameters allow you to filter out wall sets based on their type and number of walls.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   130
If this is used together with the menu, the filtered wall sets can't be selected. Without a menu, the wall set
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   131
will be randomly selected among the wall sets that meet all criteria.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   132
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   133
If the criteria filter out all available wall sets of the map, the game is played without the Walls Before Crate rule.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   134
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   135
parameter	default	description
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   136
----------------------------------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   137
walls		N/A	
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   138
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   139
Permitted values:
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   140
- leftright:		The left and right part of the border. Traditional W2W-style.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   141
- roof:			Only the top part of the border
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   142
- leftrightroof:	Combination of the two above
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   143
- inside:		Map-specific wall set where all walls are part of the terrain
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   144
- mixed:		Map-specific wall set where some walls are part of the terrain, and some are part of the map border
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   145
- none:			No walls required.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   146
- all:			Shorthand: All wall sets are allowed.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   147
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   148
Combination of multiple types is possible by concatenating the names with plus signs (see examples below).
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   149
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   150
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   151
Restrict wall numbers: With the following parameters you can restrict the pool of wall sets to only those with a certain
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   152
number of walls. Note that 2 walls are the most common type of wall set, as this is often available by default.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   153
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   154
parameter	default	description
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   155
----------------------------------------
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   156
minwalls	N/A	Filter out wall sets with less than this
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   157
maxwalls	N/A	Filter out wall sets with more than this
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   158
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   159
wallsnum	N/A	Shorthand: Combintion of minwalls and maxwalls if they are the equal.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   160
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   161
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   162
== Examples ==
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   163
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   164
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   165
SBC=true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   166
--> Keep the menu, enable Surf Before Crate by default (if available).
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   167
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   168
SBC=true, menu=false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   169
--> Enable Surf Before Crate (if available) and use the defaul walls set.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   170
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   171
AFR=true, menu=false, wallsnum=2
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   172
--> Attack From Rope rule active, and use a random wall set with 2 walls
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   173
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   174
menu=false, walls=leftright
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   175
--> Always use the classic left/right wall set automatically. Traditional W2W-style.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   176
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   177
walls=none, menu=false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   178
--> Like classic Shoppa
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   179
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   180
walls=leftright+inside+mixed, menu=false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   181
--> Randomly use either the left/right wall set, an Inside or Mixed wall set.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   182
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   183
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   184
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   185
= MORE GAME SCHEME CONFIGURATION =
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   186
You can almost set everything in the game scheme freely, and the script will work just fine together with it.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   187
Feel free to experiment a bit.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   188
The only exception are the crate frequencies. Setting them has no effect, crates are handled uniquiely in this game.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   189
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   190
At this stage, the script does not allow for custom weapon sets.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   191
]]
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   192
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   193
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   194
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   195
-----------------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   196
-- GO PONIES, GO PONIES, GO!
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   197
-----------------------------
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   198
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
   199
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
   200
HedgewarsScriptLoad("/Scripts/Tracker.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 7183
diff changeset
   201
HedgewarsScriptLoad("/Scripts/Utils.lua")
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   202
HedgewarsScriptLoad("/Scripts/Params.lua")
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   203
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   204
-- HARDCODED values
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   205
local ammoTypesNum = 58	-- number of weapon types (permanent TODO: Check this number for each Hedgewars version)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   206
local PlacementTime = 15000
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   207
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   208
-- menu stuff
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   209
local menuIndex = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   210
local menu = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   211
local preMenuCfg
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   212
local postMenuCfg
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   213
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   214
--[[ WxW preparation phase.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   215
0 = Game not started yet
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   216
1 = Configuration phase
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   217
2 = Hedgehog placement phase
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   218
100 = Game phase
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   219
]]
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   220
local roundN = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   221
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   222
-- Used to select one of the wall sets
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   223
-- 0: no walls
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   224
-- 1 and above: ID of wall sets
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   225
local wallSetID = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   226
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   227
-- Store the wall sets here
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   228
local wallSets = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   229
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   230
-- Wall set types and wall number limits for filtering
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   231
local allWallSetTypes = {"roof", "leftright", "leftrightroof", "mixed", "inside"}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   232
local allowedWallSetTypes = {roof=true, leftright=true, leftrightroof=true, mixed=true, inside=true}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   233
local minWalls, maxWalls = nil, nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   234
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   235
-- config and wall variables
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   236
local useMenu = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   237
local AFR = false		-- Attack From Rope
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   238
local WBC = true		-- Wall(s) Before Crate, will later only be set again in script parameter
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   239
local CBA = false		-- Crate Before Attack
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   240
local attackRule = nil		-- Either nil, "KTL" (Kill The Leader) or "ABL" (All But Last)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   241
local allowCrazyWeps = false	-- Super weapons
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   242
local requireSurfer = false	-- Surf Before Crate
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   243
local crateSpawned = false	-- Has the crate (or crates) been spawned in this turn yet?
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   244
local cratesPerTurn = 1		-- How many crates appear per turn (respects crate limit)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   245
local maxCrates = 12		-- default crate limit, can be configured with params
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   246
local maxCratesHard = 100	-- "hard" crate limit, to avoid extreme lagging due to many crates
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   247
local crateGearsInGame = 0
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   248
local wX = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   249
local wY = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   250
local wWidth = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   251
local wHeight = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   252
local wTouched = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   253
local wallsLeft = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   254
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   255
local hasSurfed = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   256
local allWallsHit = false
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   257
local crateCollected = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   258
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   259
-- ABL and KTL stuff
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   260
local teamNames = {}		-- List of all teams
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   261
local teamsAttacked = {}	-- List of attacked teams (in this turn)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   262
local lastTeam = nil		-- Team with the least health. Determined only at start of turn. If it's a tie, use nil.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   263
local leaderTeam = nil		-- Team with the most health. Determined only at start of turn. If it's a tie, use nil.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   264
local runnerUpTeam = nil	-- Team with the second-most health
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   265
local previousTeam = nil	-- Remember the name of the team in the previous turn
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   266
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   267
local gTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   268
local effectTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   269
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   270
local ropeG = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   271
local allowCrate = true
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   272
local crates = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   273
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   274
-- Variables for place hedgehogs mode
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   275
local hogCount = 0		-- Used to detect the end of the hog placement phase
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   276
local turnsCount = 0
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   277
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   278
-- crate radar vars
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   279
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   280
-- Set the initial radar mode here
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   281
-- 0: Radar is always active
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   282
-- 1: Radar is only active shortly after crate spawn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   283
-- 2: Radar is disabled
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   284
local radarMode = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   285
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   286
local rCirc = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   287
local rAlpha = 255
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   288
local rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   289
local m2Count = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   290
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   291
local weapons = {}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   292
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   293
local crazyWeps = {amWatermelon, amHellishBomb, amBallgun, amRCPlane}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   294
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   295
local groundWeps = 	{amBee, amShotgun,amDEagle,amFirePunch, amWhip,
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   296
				amPickHammer, amBaseballBat, amCake,amBallgun,
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   297
				amRCPlane, amSniperRifle, amBirdy, amBlowTorch,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   298
				amFlamethrower, amMortar, amHammer}
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   299
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   300
local ropeWeps = {amGrenade, amClusterBomb, amBazooka, amMine, amDynamite,
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   301
				amWatermelon, amHellishBomb, amDrill, amMolotov,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   302
				amSMine, amGasBomb}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   303
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   304
local msgColorTech = 0xFFBA00FF
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   305
local msgColorWarn = 0xFF4000FF
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   306
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   307
-- 0.9.18+ extra custom data for preset maps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   308
local MapList =
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   309
	{
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   310
	--name,					surfer, roof, 	LRwalls
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   311
	{"Alien",				true, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   312
	{"Atlantis Shoppa",			true, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   313
	{"BasketballField",			false,  false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   314
	{"BattleCity_v1",			true,	true, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   315
	{"BIGshoppa",				true,	true, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   316
	{"BambooPlinko",			true,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   317
	{"BoatWxW",				true,	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   318
	{"BrickShoppa",				false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   319
	{"BubbleFlow",				true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   320
	{"Citrouille",				true, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   321
	{"Cave",				false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   322
	{"Cheese_Ropes", 			false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   323
	{"CookieShoppa", 			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   324
	{"CrossRopes",				false,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   325
	{"FutuShoppa",				true,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   326
	{"Garden",				false,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   327
	{"Glass Shoppa",			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   328
	{"GlassShoppa2",			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   329
	{"HardIce",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   330
	{"Industrial",       			false,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   331
	{"Islands",       			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   332
	{"IslandsFlipped",     			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   333
	{"IslandsRearranged",  			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   334
	{"Hedgelove",       			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   335
	{"HellishRopes",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   336
	{"Hedgeland_v1",			true,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   337
	{"HeyLandShoppa",			false,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   338
	{"NeonStyle",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   339
	{"MaskedRopes",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   340
	{"Octorama",       			false, 	false, true},
12232
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   341
	{"Octoropisloppaking0.4",		true,   true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   342
	{"Pacman_v2",       			true,   false, true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   343
	{"Purple",       			false, 	true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   344
	{"Purple_v2",       			false, 	true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   345
	{"RacerPlayground1",			false,  true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   346
	{"RacerPlayground2",			false,  true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   347
	{"RacerPlayground3",			false,  true,  true},
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   348
	{"RacerPlayground4",			false,  true,  true},
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   349
	{"red vs blue - Castle",     		true, 	false, true},
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   350
	{"red vs blue - castle2",     		true, 	false, true},
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   351
	{"red vs blue - True Shoppa Sky",	true,	false, true},
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   352
	{"Ropes",       			false, 	true, true},
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   353
	{"RopeLikeAKingInHellWithNeon",		false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   354
	{"Ropes Flipped",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   355
	{"Ropes Rearranged",      		false, 	false, true},
12232
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   356
	{"RopesRevenge0.1",    			false, 	true,  true},
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   357
	{"RopesRevenge Flipped",    		true, 	false, true},
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   358
	{"RopesThree",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   359
	{"RopesTwo",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   360
	{"Ruler",	      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   361
	{"SandShoppa",				false,	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   362
	{"ShapeShoppa1.0",     			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   363
	{"ShapeShoppa Darkhow",      		true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   364
	{"SheepyShoppa_v2",      		true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   365
	{"shopppa",				false,  true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   366
	{"ShoppaCave2",      			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   367
	{"ShoppaChallenge",    			false, 	true, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   368
	{"ShoppaDesert",    			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   369
	{"ShoppaEvoRope_v1",			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   370
	{"ShoppaFun",      			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   371
	{"ShoppaFun2",      			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   372
	{"ShoppaGolf",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   373
	{"ShoppaHalloween",    			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   374
	{"ShoppaHell",      			false,	true,  false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   375
	{"ShoppaHellFlipped",  			true,	true,  false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   376
	{"ShoppaHellRemake",			false,	true,  false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   377
	{"ShoppaKing",       			false, 	true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   378
	{"ShoppaKingFlipped",      		true, 	false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   379
	{"ShoppaKingSideways",      		true, 	true,  false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   380
	{"ShoppaMeme",				false,	true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   381
	{"ShoppaNeon",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   382
	{"ShoppaNeonFlipped",			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   383
	{"ShoppaOnePiece2",			false, 	true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   384
	{"ShoppaQuotes2",			false,  true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   385
	{"ShoppaRainbow",			false,  false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   386
	{"ShoppaRadigme",			false,  true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   387
	{"ShoppaSilhouette",			false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   388
	{"ShoppaSpace",				true,   false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   389
	{"ShoppaSea",				true,  false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   390
	{"ShoppaShapex_v1",			false,  true, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   391
	{"ShoppaSparkle",			true,  true, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   392
	{"ShoppaSky",				false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   393
	{"ShoppaSky2",				true,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   394
	{"ShoppaSsion",				false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   395
	{"ShoppaStyle2",			true,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   396
	{"ShoppaThology",			false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   397
	{"ShoppaTournament2012",		false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   398
	{"ShoppaWild",				false,  false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   399
	{"Shoppawall",				false,  false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   400
	{"ShoppaWall2",				false,  false, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   401
	{"ShBall",				false,  true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   402
	{"ShHell",				false,  true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   403
	{"ShNeon",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   404
	{"ShoppaSky",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   405
	{"SloppyShoppa",       			false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   406
	{"SloppyShoppa2",      			false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   407
	{"SkatePark",       			false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   408
	{"Snow_Ropes",       			false, 	true, false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   409
	{"Sticks",       			true, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   410
	{"Symmetrical Ropes",       		false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   411
	{"SpartanShoppa",       		false, 	true,  true},
12232
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   412
	{"TERRORmap",				false,  false,false},
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   413
	{"Tetris",       			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   414
	{"TransRopes2",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   415
	{"TRBShoppa",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   416
	{"TrickyShoppa",      			false, 	true, false},
12232
6bf9229c5c1f Add a few more maps to the WxW Shoppa map list
Wuzzy <almikes@aol.com>
parents: 12071
diff changeset
   417
	{"Towers",      			false, 	true,  true},
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   418
	{"Wildmap",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   419
	{"Winter Shoppa",      			false, 	false, true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   420
	{"WarShoppa",      			false, 	true,  true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   421
	{"2Cshoppa",      			true, 	false, true},
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   422
	}
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   423
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   424
local Ropes_WallSet = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   425
	{ add="none", {299,932,20,856}, {4056,0,30,1788} },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   426
	{ add="none", {299,109,20,779}, {4056,0,30,1788} },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   427
	{ add="none", {299,109,20,779}, {299,932,20,856}, {4056,0,30,1788} },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   428
	{ add="default", {2253,326,20,574}, {3280,326,33,253}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   429
	{ add="roof", {2322,326,457,20} },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   430
	{ add="default", {1092,934,54,262}, {2822,323,33,137}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   431
	{ add="none", {203,1193,20,595}, {3280,326,20,253}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   432
}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   433
local Shoppawall_WallSet = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   434
	{ add="none", {80+290,61+878,20,1018}, {3433+290,61+878,20,1018}, default=true, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   435
}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   436
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   437
-- List of map with special wall settings
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   438
local SpecialMapList = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   439
	["Ropes"] = Ropes_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   440
	["HellishRopes"] = Ropes_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   441
	["MaskedRopes"] = Ropes_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   442
	["TransRopes2"] = Ropes_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   443
	["ShoppaKing"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   444
		{ add="none", {3777,1520,50,196}, {1658,338,46,670}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   445
		{ add="none", {125,0,30,2048}, {4066,515,30,1528}, default=true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   446
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   447
	["ShoppaHell"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   448
		{ add="none", {3491,697,30,1150}, {0,0,30,1847}, default=true},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   449
		{ add="none", {3810,0,30,1616}, {0,0,30,1847}, },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   450
		{ add="none", {2045,832,20,260}, {2107,832,20,260}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   451
		{ add="default", {2035,831,30,263}, {3968,1668,31,383}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   452
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   453
	["ShoppaNeon"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   454
		{ add="default", {980,400,20,300}, {1940,400,20,300}, {3088,565,26,284}, {187,270,28,266}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   455
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   456
	["Shoppawall"] = Shoppawall_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   457
	["ShoppaWall2"] = Shoppawall_WallSet,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   458
	["ShoppaDesert"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   459
		{ add="none", {2322,349,20,471}, {295,93,24,1479}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   460
		{ add="none", {3001,1535,20,232}, {2264,349,20,495},{716,696,20,119}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   461
		{ add="leftright", {209,656,20,367},{2810,838,20,96}, needsborder=false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   462
		{ add="none", {2649,0,445,20}, {2322,349,947,20},{299,696,381,20}},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   463
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   464
	["ShoppaOnePiece2"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   465
		{ add="default", {42,0,20,2048}, {4048,0,20,2048}, needsborder=false, },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   466
		{ add="default", {42,0,20,2048}, {3852,273,20,1637}, needsborder=false, default="noborder" },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   467
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   468
	["ShoppaWild"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   469
		{ add="default", {2123,1365,20,293}, {3102,1365,20,293}, {1215,1391,20,291}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   470
		{ add="none", {144,167,1904,20}, {2350,167,753,20}, {3793,167,303,20}, needsborder=false},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   471
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   472
	["ShoppaRainbow"] = {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   473
		{ add="none", {67+602,61+80,20,1847}, {2779+602,61+80,20,1847}, needsborder=false },
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   474
	},
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   475
}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   476
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   477
function BoolToCfgTxt(p)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   478
	if p == false then
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10670
diff changeset
   479
		return loc("Disabled")
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   480
	else
11301
fa18940f290d - Rus localization for following game styles:
antonc27 <antonc27@mail.ru>
parents: 10670
diff changeset
   481
		return loc("Enabled")
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   482
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   483
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   484
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   485
function AttackRuleToCfgTxt(attackRule)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   486
	if attackRule == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   487
		return loc("Disabled")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   488
	elseif attackRule == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   489
		return loc("All But Last")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   490
	elseif attackRule == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   491
		return loc("Kill The Leader")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   492
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   493
		return "ERROR"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   494
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   495
end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   496
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   497
function NewWallSet(newWallSet, wType)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   498
	-- Filter out wall sets which are not in allowed categories or have too many or few walls
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   499
	if allowedWallSetTypes[wType] == true then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   500
		local inBounds = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   501
		if minWalls ~= nil and #newWallSet < minWalls then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   502
			inBounds = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   503
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   504
		if maxWalls ~= nil and #newWallSet > maxWalls then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   505
			inBounds = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   506
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   507
		if inBounds then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   508
			table.insert(wallSets, newWallSet)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   509
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   510
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   511
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   512
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   513
function MapsInit()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   514
	mapID = nil
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   515
	margin = 20
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   516
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   517
	--0.9.18+
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   518
	for i = 1, #MapList do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   519
		if Map == MapList[i][1] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   520
			mapID = i
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   521
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   522
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   523
12068
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   524
	-- Border conditions
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   525
	-- Just a wrapper for MapHasBorder()
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   526
	local border = MapHasBorder() == true
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   527
	-- Left and right walls are available
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   528
	local leftRight = (WorldEdge == weBounce) or (WorldEdge == weNone and border)
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   529
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   530
	local left, right, roof
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   531
12068
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   532
	local startY, height
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   533
	if (not border) and (WorldEdge == weBounce) then
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   534
		-- Higher left/right walls for bouncy world edge without roof
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   535
		local h = math.max(1024, LAND_HEIGHT)
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   536
		height = h * 2
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   537
		startY = TopY - h
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   538
	else
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   539
		-- Standard left/right wall height
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   540
		height = WaterLine
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   541
		startY = TopY + 10
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   542
	end
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   543
	left = {LeftX+10, startY, margin, height}
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   544
	right = {RightX-10-margin, startY, margin, height}
e2be2e6cf544 WxW: Increase wall height of left/right walls with bounce edge and no border
Wuzzy <almikes@aol.com>
parents: 12067
diff changeset
   545
	roof = {LeftX+10, TopY+10, RightX-LeftX-20, margin}
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   546
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   547
	if mapID ~= nil then
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   548
		if border and MapList[mapID][3] == true then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   549
			NewWallSet({roof, desc=loc("Roof")}, "roof")
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   550
			wallSetID = #wallSets
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   551
		end
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   552
		if leftRight and MapList[mapID][4] == true then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   553
			NewWallSet({left, right, desc=loc("Left and right")}, "leftright")
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   554
			wallSetID = #wallSets
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   555
		end
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   556
		if leftRight and border and MapList[mapID][3] == true and MapList[mapID][4] == true then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   557
			NewWallSet({left, right, roof, desc=loc("Left, right and roof")}, "leftrightroof")
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   558
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   559
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   560
		-- add map specific walls
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   561
		if SpecialMapList[Map] ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   562
			local insideID = 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   563
			local previousInside = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   564
			local mixedID = 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   565
			local previousMixed = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   566
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   567
			-- Helper function to build the wall set name.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   568
			-- Basically just to ensure that names like "Inside 1" are only used when there are at least 2 "Insides"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   569
			local function newInsideOrMixed(ws, previous_ws, id, string, stringD)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   570
				if id == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   571
					ws.desc = string
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   572
				else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   573
					ws.desc = string.format(stringD, id)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   574
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   575
				if id == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   576
					previous_ws.desc = string.format(stringD, id-1)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   577
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   578
				id = id + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   579
				previous_ws = ws
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   580
				return id, previous_ws
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   581
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   582
			for ws=1,#SpecialMapList[Map] do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   583
				local walls = SpecialMapList[Map][ws]
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   584
				if walls.needsborder == false then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   585
					local newwallset2 = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   586
					for w=1,#walls do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   587
						table.insert(newwallset2, walls[w])
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   588
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   589
					insideID, previousInside = newInsideOrMixed(newwallset2, previousInside, insideID, loc("Inside"), loc("Inside %d"))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   590
					newwallset2.custom = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   591
					NewWallSet(newwallset2, "inside")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   592
					if SpecialMapList[Map][ws].default == "noborder" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   593
						wallSetID = #wallSets
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   594
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   595
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   596
				local newwallset = {}
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   597
				if border and leftRight and walls.add == "all" then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   598
					table.insert(newwallset, roof)
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   599
					table.insert(newwallset, left)
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   600
					table.insert(newwallset, right)
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   601
				elseif walls.add == "default" then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   602
					if border and MapList[mapID][3] == true then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   603
						table.insert(newwallset, roof)
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   604
					end
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   605
					if leftRight and MapList[mapID][4] == true then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   606
						table.insert(newwallset, left)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   607
						table.insert(newwallset, right)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   608
					end
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   609
				elseif border and walls.add == "roof" then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   610
					table.insert(newwallset, roof)
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   611
				elseif leftRight and walls.add == "leftright" then
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   612
					table.insert(newwallset, left)
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   613
					table.insert(newwallset, right)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   614
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   615
				for w=1,#walls do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   616
					table.insert(newwallset, walls[w])
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   617
				end
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   618
				if border and leftRight and ((walls.add ~= "none" and walls.add ~= nil) or walls.needsborder ~= false) then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   619
					mixedID, previousMixed = newInsideOrMixed(newwallset, previousMixed, mixedID, loc("Mixed"), loc("Mixed %d"))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   620
					newwallset.custom = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   621
					NewWallSet(newwallset, "mixed")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   622
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   623
				if SpecialMapList[Map][ws].default == true then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   624
					wallSetID = #wallSets
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   625
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   626
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   627
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   628
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   629
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   630
		if border then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   631
			NewWallSet({roof, desc=loc("Roof")}, "roof")
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   632
			wallSetID = #wallSets
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   633
		end
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   634
		if leftRight then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   635
			NewWallSet({left, right, desc=loc("Left and right")}, "leftright")
12067
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   636
			wallSetID = #wallSets
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   637
		end
18677a537d58 Add WorldEdge support for WxW
Wuzzy <almikes@aol.com>
parents: 12065
diff changeset
   638
		if leftRight and border then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   639
			NewWallSet({left, right, roof, desc=loc("Left, right and roof")}, "leftrightroof")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   640
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   641
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   642
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   643
	-- Choose random map when without without menu
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   644
	if useMenu == false and #wallSets > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   645
		wallSetID = GetRandom(#wallSets)+1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   646
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   647
	-- Select first wall set by default if we still haven't selected anything for some reason
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   648
	if wallSetID == 0 and #wallSets > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   649
		wallSetID = 1	
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   650
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   651
	-- But disabled walls from script parameter have higher priority
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   652
	if WBC == false then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   653
		wallSetID = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   654
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   655
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   656
	if CanSurf() == false then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   657
		requireSurfer = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   658
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   659
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   660
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   661
function LoadConfig(p)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   662
	ClearWalls()
12071
ecad5b4e56d9 WxW: Remove old compability code which caused problems with unknown maps
Wuzzy <almikes@aol.com>
parents: 12070
diff changeset
   663
	if p > 0 then
ecad5b4e56d9 WxW: Remove old compability code which caused problems with unknown maps
Wuzzy <almikes@aol.com>
parents: 12070
diff changeset
   664
		local walls = wallSets[p]
ecad5b4e56d9 WxW: Remove old compability code which caused problems with unknown maps
Wuzzy <almikes@aol.com>
parents: 12070
diff changeset
   665
		for i=1,#walls do
ecad5b4e56d9 WxW: Remove old compability code which caused problems with unknown maps
Wuzzy <almikes@aol.com>
parents: 12070
diff changeset
   666
			AddWall(walls[i][1], walls[i][2], walls[i][3], walls[i][4])
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   667
		end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   668
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   669
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   670
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   671
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   672
function AddWall(zXMin,zYMin, zWidth, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   673
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   674
	table.insert(wX, zXMin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   675
	table.insert(wY, zYMin)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   676
	table.insert(wWidth, zWidth)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   677
	table.insert(wHeight, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   678
	table.insert(wTouched, false)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   679
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   680
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   681
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   682
function ClearWalls()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   683
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   684
	wX = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   685
	wY = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   686
	wWidth = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   687
	wHeight = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   688
	wTouched = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   689
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   690
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   691
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   692
-- Draw a single point for the crate radar
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   693
function DrawBlip(gear)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   694
	if GetGearType(gear) ~= gtCase then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   695
		return
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   696
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   697
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   698
	local baseColor, radius, alpha
14792
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   699
	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   700
		radius = 40
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   701
		baseColor = 0xFFFFFFFF
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   702
		alpha = 255
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   703
	elseif getGearValue(gear, "frozen") then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   704
		radius = 25
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   705
		baseColor = 0xFFFFFFFF
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   706
		alpha = math.min(255, rAlpha+127)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   707
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   708
		radius = 40
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   709
		baseColor = GetClanColor(GetHogClan(CurrentHedgehog))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   710
		alpha = rAlpha
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   711
	end
13687
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   712
	if getGearValue(gear,"CIRC") ~= nil then
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   713
		SetVisualGearValues(getGearValue(gear,"CIRC"), getGearValue(gear,"RX"), getGearValue(gear,"RY"), 100, 255, 1, 10, 0, radius, 3, baseColor-alpha)
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
   714
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   715
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   716
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   717
function TrackRadarBlip(gear)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   718
	if GetGearType(gear) ~= gtCase then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   719
		return
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   720
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   721
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   722
	-- work out the distance to the target
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   723
	g1X, g1Y = GetGearPosition(CurrentHedgehog)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   724
	g2X, g2Y = GetX(gear), GetY(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   725
	q = g1X - g2X
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   726
	w = g1Y - g2Y
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   727
	r = math.sqrt( (q*q) + (w*w) )	--alternate
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   728
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   729
	RCX = getGearValue(gear,"RX")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   730
	RCY = getGearValue(gear,"RY")
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   731
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   732
	rCircDistance = r -- distance to circle
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   733
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   734
	opp = w
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   735
	if opp < 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   736
		opp = opp*-1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   737
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   738
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   739
	-- work out the angle (theta) to the target
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   740
	t = math.deg ( math.asin(opp / r) )
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   741
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   742
	-- based on the radius of the radar, calculate what x/y displacement should be
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   743
	NR = 150 -- radius at which to draw circs
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   744
	NX = math.cos( math.rad(t) ) * NR
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   745
	NY = math.sin( math.rad(t) ) * NR
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   746
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   747
	if rCircDistance < NR then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   748
		RCX = g2X
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   749
	elseif q > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   750
		RCX = g1X - NX
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   751
	else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   752
		RCX = g1X + NX
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   753
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   754
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   755
	if rCircDistance < NR then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   756
		RCY = g2Y
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   757
	elseif w > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   758
		RCY = g1Y - NY
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   759
	else
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   760
		RCY = g1Y + NY
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   761
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   762
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   763
	setGearValue(gear, "RX", RCX)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   764
	setGearValue(gear, "RY", RCY)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   765
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   766
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   767
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   768
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   769
function HandleCircles()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   770
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   771
	if radarMode == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   772
		rAlpha = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   773
	elseif radarMode == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   774
		-- Only show radar for a short time after a crate spawn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   775
		if rAlpha ~= 255 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   776
			rPingTimer = rPingTimer + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   777
			if rPingTimer == 100 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   778
				rPingTimer = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   779
	
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   780
				rAlpha = rAlpha + 5
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   781
				if rAlpha >= 255 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   782
					rAlpha = 255
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   783
				end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   784
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   785
		end
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   786
	elseif radarMode == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   787
		rAlpha = 255
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   788
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   789
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   790
	runOnGears(DrawBlip)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   791
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   792
	m2Count = m2Count + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   793
	if m2Count == 25 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   794
		m2Count = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   795
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   796
		if (CurrentHedgehog ~= nil) and (rAlpha ~= 255) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   797
			runOnGears(TrackRadarBlip)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   798
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   799
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   800
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   801
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   802
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   803
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   804
-- Returns true if crates are allowed to be accessed right now (used for unfreezing and spawning)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   805
function AreCratesUnlocked()
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   806
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   807
	local crateSpawn = true
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   808
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   809
	if requireSurfer == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   810
		if hasSurfed == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   811
			crateSpawn = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   812
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   813
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   814
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   815
	if #wTouched > 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   816
		if allWallsHit == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   817
			crateSpawn = false
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   818
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   819
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   820
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   821
	return crateSpawn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   822
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   823
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   824
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   825
-- Freeze all crates,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   826
function FreezeCrates()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   827
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   828
	local cratesFrozen = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   829
	for crate, isCrate in pairs(crates) do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   830
		local state = GetState(crate)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   831
		-- Freeze crate if it wasn't already frozen
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   832
		if band(state, gstFrozen) == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   833
			cratesFrozen = cratesFrozen + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   834
			SetState(crate, bor(GetState(crate), gstFrozen))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   835
			setGearValue(crate, "frozen", true)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   836
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   837
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   838
	-- Play sound if at least one new (!) crate was frozen
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   839
	if cratesFrozen > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   840
		PlaySound(sndHogFreeze)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   841
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   842
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   843
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   844
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   845
-- Unfreeze all crates
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   846
function UnfreezeCrates()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   847
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   848
	for crate, isCrate in pairs(crates) do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   849
		SetState(crate, band(GetState(crate), bnot(gstFrozen)))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   850
		setGearValue(crate, "frozen", false)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   851
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   852
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   853
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   854
14791
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   855
function onCaseDrop()
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   856
	if roundN == 100 then
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   857
		allowCrate = crateGearsInGame < maxCrates
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   858
		CheckCrateConditions()
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   859
	end
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   860
end
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   861
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   862
function CheckCrateConditions()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   863
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   864
	local crateSpawn = AreCratesUnlocked()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   865
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   866
	if crateSpawn == true and crateSpawned == false then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   867
		UnfreezeCrates()
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   868
		if allowCrate == true then
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   869
			local cratesInGame = crateGearsInGame
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   870
			local toSpawn = cratesPerTurn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   871
			if cratesInGame + toSpawn > maxCrates then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   872
				toSpawn = maxCrates - cratesInGame
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   873
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   874
			for i=1,toSpawn do
12933
e65aa3c3d4e6 Refactor scripts to use SpawnSupplyCrate (where it makes sense)
Wuzzy <Wuzzy2@mail.ru>
parents: 12624
diff changeset
   875
				SpawnSupplyCrate(0, 0, weapons[1+GetRandom(#weapons)] )
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   876
			end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   877
			rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   878
			rAlpha = 0
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   879
			if toSpawn > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   880
				PlaySound(sndWarp)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   881
			end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   882
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   883
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   884
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   885
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   886
10670
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
   887
function onGearWaterSkip(gear)
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
   888
	if gear == CurrentHedgehog then
638af9cb922b make use of onGearWaterSkip
mikade <redgrinner@gmail.com>
parents: 10036
diff changeset
   889
		hasSurfed = true
13643
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13512
diff changeset
   890
		AddCaption(loc("Surfer!"), capcolDefault, capgrpMessage2)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   891
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   892
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   893
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   894
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   895
function WallHit(id, zXMin,zYMin, zWidth, zHeight)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   896
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   897
	if wTouched[id] == false then
13685
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13643
diff changeset
   898
		AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtBigExplosion, 0, false)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   899
		PlaySound(sndExplosion)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   900
		wallsLeft = wallsLeft - 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   901
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   902
		if wallsLeft == 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   903
			AddCaption(loc("All walls touched!"))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   904
			allWallsHit = true
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   905
			if (requireSurfer == true) and (hasSurfed == false) then
13643
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13512
diff changeset
   906
				AddCaption(loc("Go surf!"), capcolDefault, capgrpMessage2)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   907
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   908
		else
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   909
			AddCaption(string.format(loc("Walls left: %d"), wallsLeft))
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   910
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   911
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   912
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   913
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   914
	wTouched[id] = true
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   915
	if #wTouched > 0 then
13685
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13643
diff changeset
   916
		AddVisualGear(GetX(CurrentHedgehog), GetY(CurrentHedgehog), vgtSmoke, 0, false)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   917
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   918
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   919
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   920
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   921
function CheckForWallCollision()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   922
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   923
	for i = 1, #wTouched do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   924
		if gearIsInBox(CurrentHedgehog, wX[i],wY[i],wWidth[i],wHeight[i]) then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   925
			WallHit(i, wX[i],wY[i],wWidth[i],wHeight[i])
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   926
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   927
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   928
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   929
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   930
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   931
function BorderSpark(zXMin,zYMin, zWidth, zHeight, bCol)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   932
12070
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   933
	local size = zWidth * zHeight
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   934
	-- Add multiple sparks for very large walls
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   935
	sparkRuns = math.min(10, math.max(1, div(size, 10240)))
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   936
	for i=1, sparkRuns do
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   937
		local eX = zXMin + GetRandom(zWidth+10)
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   938
		local eY = zYMin + GetRandom(zHeight+10)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   939
12070
03ba438dd597 Tweak WxW wall spark count according to wall size
Wuzzy <almikes@aol.com>
parents: 12069
diff changeset
   940
		local tempE = AddVisualGear(eX, eY, vgtDust, 0, false)
13685
09ea1faf97ca Remove calls to GetVisualGearValues where it's not needed
Wuzzy <Wuzzy2@mail.ru>
parents: 13643
diff changeset
   941
		SetVisualGearValues(tempE, eX, eY, nil, nil, nil, nil, nil, 1, nil, bCol )
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   942
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   943
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   944
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   945
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   946
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   947
function HandleBorderEffects()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   948
14792
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
   949
	if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then
14791
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   950
		return
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
   951
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   952
	effectTimer = effectTimer + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   953
	if effectTimer > 15 then --25
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   954
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   955
		effectTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   956
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   957
		for i = 1, #wTouched do
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   958
			if wTouched[i] == false then
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   959
				bCol = GetClanColor(GetHogClan(CurrentHedgehog))
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   960
				BorderSpark(wX[i],wY[i],wWidth[i],wHeight[i], bCol)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   961
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   962
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   963
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   964
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   965
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   966
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   967
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   968
function PlaceWarn()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   969
	PlaySound(sndDenied)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   970
	AddCaption(loc("Please place your hedgehog first!"), msgColorWarn, capgrpMessage2)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   971
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   972
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   973
function onLJump()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   974
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   975
		PlaySound(sndPlaced)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
   976
		SetInputMask(0xFFFFFFFF)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   977
		AddCaption(loc("Configuration accepted."), msgColorTech, capgrpMessage)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   978
		if GetGameFlag(gfPlaceHog) then
13742
2bb7141496a9 Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13687
diff changeset
   979
			SetTurnTimeLeft(PlacementTime)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   980
			AddAmmo(CurrentHedgehog, amTeleport, 100)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   981
			SetWeapon(amTeleport)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   982
			AddCaption(
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   983
				string.format(loc("%s, place the first hedgehog!"), GetHogTeamName(CurrentHedgehog)),
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   984
				0xFFFFFFFF,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   985
				capgrpMessage2
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   986
			)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   987
			roundN = 2
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   988
		else
13742
2bb7141496a9 Use SetTurnTimeLeft and SetReadyTimeLeft in all scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13687
diff changeset
   989
			SetTurnTimeLeft(TurnTime)
13643
690cc84e9fd6 Use capcolDefault in Lua scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13512
diff changeset
   990
			AddCaption(string.format(loc("Let's go, %s!"), GetHogTeamName(CurrentHedgehog)), capcolDefault, capgrpMessage2)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   991
			roundN = 100
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   992
			wallsLeft = #wTouched
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   993
			allowCrate = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   994
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   995
		PlaySound(sndYesSir, CurrentHedgehog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   996
		FinalizeMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   997
	elseif roundN == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   998
		PlaceWarn()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
   999
	elseif roundN == 100 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1000
		if CBA and not crateCollected then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1001
			if (GetCurAmmoType() ~= amRope) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1002
				(GetCurAmmoType() ~= amSkip) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1003
				(GetCurAmmoType() ~= amNothing) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1004
				(ropeG ~= nil)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1005
			then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1006
				AddCaption(loc("You must first collect a crate before you attack!"), msgColorWarn, capgrpMessage2)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1007
				PlaySound(sndDenied)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1008
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1009
		end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1010
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1011
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1012
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1013
function onAttack()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1014
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1015
		if menu[menuIndex].activate ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1016
			menu[menuIndex].activate()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1017
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1018
			menu[menuIndex].doNext()
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1019
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1020
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1021
		UpdateMenu()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1022
		configureWeapons()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1023
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1024
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1025
		PlaySound(sndSwitchHog)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1026
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1027
	elseif roundN == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1028
		if GetCurAmmoType() ~= amSkip and GetCurAmmoType() ~= amNothing then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1029
			PlaceWarn()
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1030
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1031
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1032
	elseif roundN == 100 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1033
		local weaponSelected = (GetCurAmmoType() ~= amRope) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1034
			(GetCurAmmoType() ~= amSkip) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1035
			(GetCurAmmoType() ~= amNothing) and
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1036
			(ropeG == nil)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1037
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1038
		if weaponSelected then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1039
			if AFR and CBA and not crateCollected then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1040
				AddCaption(loc("You must attack from a rope, after you collected a crate!"), msgColorWarn, capgrpMessage2)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1041
				PlaySound(sndDenied)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1042
			elseif AFR then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1043
				AddCaption(loc("You may only attack from a rope!"), msgColorWarn, capgrpMessage2)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1044
				PlaySound(sndDenied)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1045
			elseif CBA and not crateCollected then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1046
				AddCaption(loc("You must first collect a crate before you attack!"), msgColorWarn, capgrpMessage2)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1047
				PlaySound(sndDenied)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1048
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1049
		end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1050
	end
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1051
end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1052
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1053
function onSwitch()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1054
	-- Must be in-game, hog must be controlled by player and hog must be on rope or have rope selected
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1055
	if roundN == 100 and CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 and (ropeG ~= nil or GetCurAmmoType() == amRope) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1056
		-- Toggle radar mode
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1057
		radarMode = radarMode + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1058
		if radarMode > 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1059
			radarMode = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1060
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1061
		local message
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1062
		if radarMode == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1063
			message = loc("Radar: On")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1064
		elseif radarMode == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1065
			message = loc("Radar: Show after crate drop")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1066
		elseif radarMode == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1067
			message = loc("Radar: Off")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1068
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1069
		AddCaption(message, GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1070
		-- Remember the radar mode for this team to restore it on the team's next turn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1071
		setTeamValue(GetHogTeamName(CurrentHedgehog), "radarMode", radarMode)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1072
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1073
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1074
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1075
function onLeft()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1076
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1077
		if menu[menuIndex].doPrev ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1078
			menu[menuIndex].doPrev()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1079
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1080
			menu[menuIndex].activate()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1081
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1082
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1083
		UpdateMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1084
		configureWeapons()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1085
		HandleStartingStage()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1086
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1087
		PlaySound(sndSwitchHog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1088
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1089
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1090
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1091
function onRight()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1092
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1093
		if menu[menuIndex].doNext ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1094
			menu[menuIndex].doNext()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1095
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1096
			menu[menuIndex].activate()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1097
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1098
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1099
		UpdateMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1100
		configureWeapons()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1101
		HandleStartingStage()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1102
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1103
		PlaySound(sndSwitchHog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1104
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1105
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1106
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1107
function onDown()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1108
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1109
		PlaySound(sndSteps)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1110
		menuIndex = menuIndex +1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1111
		if menuIndex > #menu then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1112
			menuIndex = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1113
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1114
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1115
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1116
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1117
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1118
function onUp()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1119
	if roundN == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1120
		PlaySound(sndSteps)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1121
		menuIndex = menuIndex -1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1122
		if 	menuIndex == 0 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1123
			menuIndex = #menu
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1124
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1125
		HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1126
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1127
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1128
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1129
function parseBool(key, default)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1130
	if params[key]=="true" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1131
		return true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1132
	elseif params[key]=="false" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1133
		return false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1134
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1135
		return default
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1136
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1137
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1138
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1139
function parseInt(key, default, min, max)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1140
	local num = tonumber(params[key])
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1141
	if type(num) ~= "number" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1142
		return default
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1143
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1144
	if min ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1145
		num = math.max(min, num)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1146
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1147
	if max ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1148
		num = math.min(max, num)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1149
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1150
	return num
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1151
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1152
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1153
function onParameters()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1154
	parseParams()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1155
	local tmpParam
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1156
	useMenu = parseBool("menu", useMenu)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1157
	requireSurfer = parseBool("SBC", requireSurfer)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1158
	AFR = parseBool("AFR", AFR)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1159
	CBA = parseBool("CBA", CBA)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1160
	if params["attackrule"] == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1161
		attackRule = "ABL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1162
	elseif params["attackrule"] == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1163
		attackRule = "KTL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1164
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1165
	allowCrazyWeps = parseBool("SW", allowCrazyWeps)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1166
	maxCrates = parseInt("maxcrates", maxCrates, 1, maxCratesHard)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1167
	cratesPerTurn = parseInt("cratesperturn", cratesPerTurn, 1, maxCrates)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1168
	local wallsParam = params["walls"]
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1169
	local wallsParamSelection = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1170
	if wallsParam ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1171
		if wallsParam == "all" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1172
			wallsParamSelection = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1173
			allowedWallSetTypes = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1174
			for i=1,#allWallSetTypes do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1175
				allowedWallSetTypes[allWallSetTypes[i]] = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1176
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1177
		elseif wallsParam == "none" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1178
			WBC = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1179
			allowedWallSetTypes = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1180
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1181
			wallsParamSelection = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1182
			allowedWallSetTypes = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1183
			local parsedWords = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1184
			for k,v in string.gmatch(wallsParam, "(%w+)") do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1185
				table.insert(parsedWords, k)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1186
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1187
			for i=1,#allWallSetTypes do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1188
				for j=1,#parsedWords do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1189
					if allWallSetTypes[i] == parsedWords[j] then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1190
						allowedWallSetTypes[allWallSetTypes[i]] = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1191
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1192
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1193
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1194
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1195
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1196
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1197
	-- Upper and lower bounds
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1198
	local wallsNum = parseInt("wallsnum", nil, 0)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1199
	if wallsNum == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1200
		WBC = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1201
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1202
	minWalls = wallsNum
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1203
	maxWalls = wallsNum
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1204
	-- minwalls and maxwalls take precedence over wallsnum
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1205
	minWalls = parseInt("minwalls", minWalls, 1)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1206
	maxWalls = parseInt("maxwalls", maxWalls, 1)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1207
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1208
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1209
function onGameInit()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1210
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1211
	HealthCaseProb = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1212
	CaseFreq = 0
12069
b2f2ac53cbab WxW: Add crate radar info to rope description
Wuzzy <almikes@aol.com>
parents: 12068
diff changeset
  1213
	SetAmmoDescriptionAppendix(amRope, loc("Switch: Toggle crate radar"))
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1214
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1215
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1216
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1217
function configureWeapons()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1218
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1219
	-- reset wep array
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1220
	for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1221
		weapons[i] = nil
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1222
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1223
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1224
	-- add rope weps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1225
	for i, w in pairs(ropeWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1226
        table.insert(weapons, w)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1227
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1228
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1229
	-- add ground weps
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1230
	for i, w in pairs(groundWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1231
        table.insert(weapons, w)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1232
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1233
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1234
	-- remove ground weps if attacking from rope is mandatory
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1235
	if AFR == true then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1236
		for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1237
			for w = 1, #groundWeps do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1238
				if groundWeps[w] == weapons[i] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1239
					table.remove(weapons, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1240
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1241
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1242
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1243
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1244
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1245
	-- remove crazy weps is crazy weps aren't allowed
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1246
	if allowCrazyWeps == false then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1247
		for i = 1, #weapons do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1248
			for w = 1, #crazyWeps do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1249
				if crazyWeps[w] == weapons[i] then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1250
					table.remove(weapons, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1251
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1252
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1253
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1254
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1255
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1256
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1257
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1258
function onGameStart()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1259
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1260
	trackTeams()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1261
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1262
	MapsInit()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1263
	LoadConfig(wallSetID)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1264
	configureWeapons()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1265
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1266
	-- ABL or KTL only make sense with at least 3 teams, otherwise we disable it
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1267
	if TeamsCount < 3 or ClansCount < 3 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1268
		attackRule = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1269
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1270
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1271
	if useMenu then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1272
		ShowMission(loc("Wall to wall"), loc("Please wait …"), "", 2, 300000)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1273
		UpdateMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1274
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1275
		if GetGameFlag(gfPlaceHog) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1276
			roundN = 2
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1277
			FinalizeMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1278
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1279
			allowCrate = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1280
			roundN = 100
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1281
			FinalizeMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1282
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1283
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1284
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1285
14791
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1286
function onEndTurn()
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1287
	crateSpawned = false
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1288
	crateCollected = false
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1289
	wallsLeft = #wTouched
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1290
	for i = 1, #wTouched do
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1291
		wTouched[i] = false
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1292
	end
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1293
	hasSurfed = false
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1294
	allWallsHit = false
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1295
end
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1296
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1297
function onNewTurn()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1298
	turnsCount = turnsCount + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1299
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1300
	if roundN == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1301
		roundN = 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1302
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1303
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1304
	if GetGameFlag(gfPlaceHog) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1305
		if roundN < 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1306
			SetWeapon(amSkip)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1307
			AddAmmo(CurrentHedgehog, amTeleport, 0)
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
  1308
			SetTurnTimeLeft(MAX_TURN_TIME)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1309
			SetInputMask(0)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1310
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1311
		if roundN == 2 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1312
			if turnsCount > hogCount then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1313
				roundN = 100
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1314
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1315
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1316
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1317
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1318
	if roundN == 100 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1319
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1320
		local teamName = GetHogTeamName(CurrentHedgehog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1321
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1322
		-- Restore team's radar mode
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1323
		radarMode = getTeamValue(teamName, "radarMode")
14792
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1324
		if radarMode == nil then
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1325
			radarMode = 0
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1326
		end
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1327
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1328
		if not AreCratesUnlocked() then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1329
			FreezeCrates()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1330
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1331
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1332
		-- Check the attack rule violation of the *previous* team and apply penalties
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1333
		-- This function will do nothiong in the first turn since previousTeam is still nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1334
		CheckAttackRuleViolation(previousTeam)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1335
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1336
		previousTeam = teamName
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1337
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1338
		-- Update attack rule information for this turn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1339
		UpdateLastAndLeaderTeams()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1340
		teamsAttacked = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1341
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1342
		-- Was the team violating the attackRule the last time?
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1343
		if getTeamValue(teamName, "skipPenalty") then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1344
			-- Then take away this turn
12287
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
  1345
			AddCaption(string.format(loc("%s must skip this turn for rule violation."), teamName), msgColorWarn, capgrpMessage)
faf1b93422ba Use new EndTurn in a couple of scripts, esp. to fix timeout taunts in Racer
Wuzzy <almikes@aol.com>
parents: 12232
diff changeset
  1346
			EndTurn(true)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1347
			setTeamValue(teamName, "skipPenalty", false)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1348
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1349
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1350
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1351
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1352
	if roundN == 1 then
13752
110d6c1e817f Lua: Rename globals: NoPointX→NO_CURSOR, cMaxTurnTime→MAX_TURN_TIME, cMaxHogHealth→MAX_HOG_HEALTH
Wuzzy <Wuzzy2@mail.ru>
parents: 13742
diff changeset
  1353
		SetTurnTimeLeft(MAX_TURN_TIME)
7183
95dc11d648fb tidy flags
nemo
parents: 7095
diff changeset
  1354
		SetInputMask(0)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1355
		allowCrate = false
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1356
		UpdateMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1357
		AddCaption(string.format(loc("%s may choose the rules."), GetHogTeamName(CurrentHedgehog)), msgColorTech, capgrpGameState)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1358
		HandleStartingStage()
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1359
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1360
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1361
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1362
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1363
function CanSurf()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1364
	if mapID ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1365
		if GetGameFlag(gfBottomBorder) and WaterRise == 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1366
			return false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1367
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1368
			return MapList[mapID][2]
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1369
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1370
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1371
		return nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1372
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1373
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1374
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1375
function UpdateMenu()
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1376
	local teamInfo
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1377
	if roundN == 1 and CurrentHedgehog ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1378
		teamInfo = string.format(loc("%s, you may choose the rules."), GetHogTeamName(CurrentHedgehog)) 
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1379
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1380
		teamInfo = ""
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1381
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1382
	preMenuCfg =	teamInfo .. "|" ..
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1383
			loc("Press [Up] and [Down] to move between menu items.|Press [Attack], [Left], or [Right] to toggle.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1384
	if GetGameFlag(gfPlaceHog) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1385
		postMenuCfg = loc("Press [Long jump] to accept this configuration and begin placing hedgehogs.")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1386
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1387
		postMenuCfg = loc("Press [Long jump] to accept this configuration and start the game.")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1388
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1389
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1390
	-- This table contains the menu strings and functions to be called when the entry is activated.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1391
	menu = {}
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1392
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1393
	-- Walls required (hidden if the current settings don't allow for any walls)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1394
	if #wallSets > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1395
		local line
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1396
		if #wTouched > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1397
			if wallSets[wallSetID].custom then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1398
				line = string.format(loc("Wall set: %s (%d walls)"), wallSets[wallSetID].desc, #wTouched) .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1399
			else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1400
				line = string.format(loc("Wall set: %s"), wallSets[wallSetID].desc) .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1401
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1402
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1403
			line = loc("Wall set: No walls") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1404
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1405
		table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1406
			line = line,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1407
			doNext = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1408
				wallSetID = wallSetID + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1409
				if wallSetID > #wallSets then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1410
					wallSetID = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1411
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1412
				LoadConfig(wallSetID)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1413
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1414
			doPrev = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1415
				wallSetID = wallSetID - 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1416
				if wallSetID < 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1417
					wallSetID = #wallSets
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1418
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1419
				LoadConfig(wallSetID)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1420
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1421
		})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1422
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1423
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1424
	-- Surf Before Crate (hidden if map disabled it)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1425
	if CanSurf() == true or CanSurf() == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1426
		local toggleSurf = function() requireSurfer = not(requireSurfer) end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1427
		table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1428
			line = string.format(loc("Surf Before Crate: %s"), BoolToCfgTxt(requireSurfer)) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1429
			activate = function() requireSurfer = not requireSurfer end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1430
		})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1431
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1432
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1433
	-- Attack From Rope
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1434
	table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1435
		line = string.format(loc("Attack From Rope: %s"), BoolToCfgTxt(AFR)) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1436
		activate = function() AFR = not AFR end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1437
	})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1438
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1439
	-- Crate Before Attack
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1440
	table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1441
		line = string.format(loc("Crate Before Attack: %s"), BoolToCfgTxt(CBA)) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1442
		activate = function() CBA = not CBA end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1443
	})
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1444
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1445
	if TeamsCount >= 3 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1446
		-- Attack rule (Disabled / All But Last / Kill The Leader)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1447
		table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1448
			line = string.format(loc("Attack rule: %s"), AttackRuleToCfgTxt(attackRule)) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1449
			doNext = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1450
				if attackRule == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1451
					attackRule = "ABL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1452
				elseif attackRule == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1453
					attackRule = "KTL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1454
				elseif attackRule == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1455
					attackRule = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1456
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1457
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1458
			doPrev = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1459
				if attackRule == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1460
					attackRule = "KTL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1461
				elseif attackRule == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1462
					attackRule = nil 
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1463
				elseif attackRule == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1464
					attackRule = "ABL"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1465
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1466
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1467
		})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1468
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1469
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1470
	-- Super weapons
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1471
	table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1472
		line = string.format(loc("Super weapons: %s"), BoolToCfgTxt(allowCrazyWeps)) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1473
		activate = function() allowCrazyWeps = not allowCrazyWeps end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1474
	})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1475
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1476
	-- Number of crates which appear per turn
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1477
	if maxCrates > 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1478
		table.insert(menu, {
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1479
			line = string.format(loc("Crates per turn: %d"), cratesPerTurn) .. "|",
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1480
			doNext = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1481
				cratesPerTurn = cratesPerTurn + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1482
				if cratesPerTurn > maxCrates then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1483
					cratesPerTurn = 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1484
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1485
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1486
			doPrev = function()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1487
				cratesPerTurn = cratesPerTurn - 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1488
				if cratesPerTurn < 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1489
					cratesPerTurn = maxCrates
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1490
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1491
			end,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1492
		})
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1493
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1494
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1495
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1496
function FinalizeMenu()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1497
	local text = ""
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1498
	local showTime = 3000
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1499
	if #wTouched == 0 and not requireSurfer then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1500
		text = text .. loc("Collect the crate and attack!") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1501
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1502
		text = text .. loc("Spawn the crate and attack!") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1503
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1504
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1505
	-- Expose a few selected game flags
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1506
	if GetGameFlag(gfPlaceHog)  then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1507
		text = text .. loc("Place hedgehogs: Place your hedgehogs at the start of the game.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1508
		showTime = 6000
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1509
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1510
	if GetGameFlag(gfResetWeps) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1511
		text = text .. loc("Weapons reset: The weapons are reset after each turn.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1512
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1513
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1514
	-- Show the WxW rules
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1515
	if #wTouched == 1 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1516
		text = text .. loc("Wall Before Crate: You must touch the marked wall before you can get crates.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1517
	elseif #wTouched > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1518
		text = text .. string.format(loc("Walls Before Crate: You must touch the %d marked walls before you can get crates."), #wTouched) .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1519
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1520
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1521
	if requireSurfer then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1522
		text = text .. loc("Surf Before Crate: You must bounce off the water once before you can get crates.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1523
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1524
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1525
	if AFR then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1526
		text = text .. loc("Attack From Rope: You may only attack from a rope.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1527
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1528
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1529
	if CBA then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1530
		text = text .. loc("Crate Before Attack: You must collect a crate before you can attack.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1531
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1532
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1533
	if attackRule == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1534
		text = text .. loc("All But Last: You must not solely attack the team with the least health") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1535
	elseif attackRule == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1536
		text = text .. loc("Kill The Leader: You must also hit the team with the most health.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1537
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1538
	if attackRule ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1539
		text = text .. loc("Penalty: If you violate above rule, you have to skip in the next turn.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1540
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1541
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1542
	if allowCrazyWeps then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1543
		text = text .. loc("Super weapons: A few crates contain very powerful weapons.") .. "|"
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1544
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1545
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1546
	ShowMission(loc("Wall to wall"), loc("A Shoppa minigame"), text, 1, showTime)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1547
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1548
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1549
function HandleStartingStage()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1550
14003
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1551
	local renderedLines = {}
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1552
	for m = 1, #menu do
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1553
		local marker
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1554
		local line = menu[m].line
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1555
		if m == menuIndex then
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1556
			marker = "▶"
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1557
		else
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1558
			marker = "▷"
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1559
			line = string.gsub(line, ":", "\\:")
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1560
		end
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1561
		table.insert(renderedLines, marker .. " " .. line)
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1562
	end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1563
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1564
	missionComment = ""
14003
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1565
	for l = 1, #renderedLines do
681a53c8b18c Prettify the menu arrows in WxW
Wuzzy <Wuzzy2@mail.ru>
parents: 13752
diff changeset
  1566
		missionComment = missionComment .. renderedLines[l]
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1567
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1568
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1569
	ShowMission	(
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1570
				loc("Wall to wall"),
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1571
				loc("Configuration phase"),
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1572
				preMenuCfg..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1573
				missionComment ..
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1574
				postMenuCfg ..
13468
4c47a480009b Prevent manual hiding of some special mission panels
Wuzzy <Wuzzy2@mail.ru>
parents: 12933
diff changeset
  1575
				"", 2, 9999000, true
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1576
				)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1577
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1578
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1579
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1580
function onGameTick()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1581
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1582
	if CurrentHedgehog ~= nil and roundN >= 0 then
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1583
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1584
		gTimer = gTimer + 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1585
		if gTimer == 25 then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1586
			gTimer = 1
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1587
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1588
			if roundN == 100 then
14791
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1589
				if band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then
14793
f5dcf47dff2c WxW: Don't register wall touch if not gstHHDriven
Wuzzy <Wuzzy2@mail.ru>
parents: 14792
diff changeset
  1590
					CheckForWallCollision()
14791
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1591
					CheckCrateConditions()
0ee6b01c7f30 WxW: If walls are disabled, spawn crate between turns
Wuzzy <Wuzzy2@mail.ru>
parents: 14003
diff changeset
  1592
				end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1593
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1594
				if (GetGearType(GetFollowGear()) == gtCase) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1595
					FollowGear(CurrentHedgehog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1596
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1597
				
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1598
				-- AFR and CBA handling
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1599
				local allowAttack = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1600
				local shootException
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1601
				shootException = (GetCurAmmoType() == amRope) or
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1602
					(GetCurAmmoType() == amSkip) or
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1603
					(GetCurAmmoType() == amNothing)
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1604
				-- If Attack From Rope is set, forbid firing unless using rope
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1605
				if AFR then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1606
					if ropeG == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1607
						allowAttack = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1608
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1609
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1610
				-- If Crate Before Attack is set, forbid firing if crate is not collected
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1611
				if CBA then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1612
					if not crateCollected then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1613
						allowAttack = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1614
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1615
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1616
				if allowAttack or shootException then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1617
					SetInputMask(bor(GetInputMask(), gmAttack))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1618
					if CBA then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1619
						SetInputMask(bor(GetInputMask(), gmLJump))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1620
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1621
				else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1622
					if CBA then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1623
						if ropeG == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1624
							SetInputMask(band(GetInputMask(), bnot(gmAttack)))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1625
							SetInputMask(bor(GetInputMask(), gmLJump))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1626
						else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1627
							SetInputMask(bor(GetInputMask(), gmAttack))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1628
							SetInputMask(band(GetInputMask(), bnot(gmLJump)))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1629
						end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1630
					else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1631
						SetInputMask(band(GetInputMask(), bnot(gmAttack)))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1632
					end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1633
				end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1634
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1635
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1636
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1637
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1638
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1639
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1640
14792
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1641
	HandleBorderEffects()
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1642
	HandleCircles()
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1643
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1644
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1645
12624
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1646
local menuRepeatTimer = 0
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1647
function onGameTick20()
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1648
  -- Make sure the menu doesn't disappear while it is active
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1649
  if roundN == 1 then
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1650
    menuRepeatTimer = menuRepeatTimer + 20
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1651
    if menuRepeatTimer > 9990000 then
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1652
      HandleStartingStage()
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1653
      menuRepeatTimer = 0
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1654
    end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1655
  end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1656
end
705dde538519 ACF1, fruit01, WxW: Make sure the selection dialogues never disappear on their own
Wuzzy <almikes@aol.com>
parents: 12287
diff changeset
  1657
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1658
function onGearAdd(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1659
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1660
	if GetGearType(gear) == gtRope then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1661
		ropeG = gear
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1662
	elseif GetGearType(gear) == gtCase then
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1663
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1664
		crates[gear] = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1665
		crateGearsInGame = crateGearsInGame + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1666
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1667
		trackGear(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1668
13687
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1669
		local vg = AddVisualGear(0, 0, vgtCircle, 0, true)
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1670
		if vg then
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1671
			table.insert(rCirc, vg)
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1672
			setGearValue(gear,"CIRC",vg)
14792
97a36fb44123 WxW: Hide crate radar when no active hog
Wuzzy <Wuzzy2@mail.ru>
parents: 14791
diff changeset
  1673
			SetVisualGearValues(vg, 0, 0, 100, 255, 1, 10, 0, 40, 3, 0x0)
13687
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1674
		end
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1675
		setGearValue(gear,"RX",0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1676
		setGearValue(gear,"RY",0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1677
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1678
		allowCrate = false
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1679
		crateSpawned = true
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1680
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1681
		rPingTimer = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1682
		rAlpha = 0
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1683
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1684
	elseif GetGearType(gear) == gtHedgehog then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1685
		trackGear(gear)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1686
		local teamName = GetHogTeamName(gear)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1687
		-- Initialize radar mode to “on” and set other team values
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1688
		setTeamValue(teamName, "radarMode", 0)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1689
		setTeamValue(teamName, "skipPenalty", false)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1690
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1691
		if getTeamValue(teamName, "hogs") == nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1692
			setTeamValue(teamName, "hogs", 1)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1693
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1694
			increaseTeamValue(teamName, "hogs")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1695
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1696
		hogCount = hogCount + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1697
		teamNames[GetHogTeamName(gear)] = true
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1698
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1699
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1700
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1701
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1702
function onGearDelete(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1703
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1704
	local gt = GetGearType(gear)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1705
	if gt == gtRope then
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1706
		ropeG = nil
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1707
	elseif gt == gtCase then
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1708
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1709
		crates[gear] = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1710
		crateGearsInGame = crateGearsInGame - 1
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1711
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1712
		for i = 1, #rCirc do
13687
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1713
			local CIRC = getGearValue(gear,"CIRC")
a8b2a5e7e9db Clean up more visual gears stuff in scripts
Wuzzy <Wuzzy2@mail.ru>
parents: 13685
diff changeset
  1714
			if CIRC ~= nil and rCirc[i] == CIRC then
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1715
				DeleteVisualGear(rCirc[i])
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1716
				table.remove(rCirc, i)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1717
			end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1718
		end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1719
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1720
		trackDeletion(gear)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1721
12065
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1722
		-- Was crate collected?
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1723
		if band(GetGearMessage(gear), gmDestroy) ~= 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1724
			crateCollected = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1725
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1726
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1727
	elseif gt == gtHedgehog then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1728
		teamsAttacked[GetHogTeamName(gear)] = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1729
		decreaseTeamValue(GetHogTeamName(gear), "hogs")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1730
		trackDeletion(gear)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1731
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1732
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1733
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1734
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1735
function onGearDamage(gear)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1736
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1737
	if GetGearType(gear) == gtHedgehog then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1738
		teamsAttacked[GetHogTeamName(gear)] = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1739
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1740
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1741
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1742
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1743
-- Check which team is the last and which is the leader (used for ABL and KTL)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1744
function UpdateLastAndLeaderTeams()
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1745
	local teamHealths = {}
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1746
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1747
	for team, x in pairs(teamNames) do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1748
		UpdateTeamHealth(team)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1749
		local totalHealth = getTeamValue(team, "totalHealth")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1750
		if totalHealth > 0 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1751
			table.insert(teamHealths, {name = team, health = totalHealth } )
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1752
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1753
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1754
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1755
	-- Sort the table by health, lowest health comes first
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1756
	table.sort(teamHealths, function(team1, team2) return team1.health < team2.health end)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1757
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1758
	-- ABL and KTL rules are only active at 3 teams; when there are only 2 teams left, it's “everything goes”.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1759
	if #teamHealths >= 3 then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1760
		if teamHealths[1].health == teamHealths[2].health then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1761
			-- ABL rule is disabled if it's a tie for “least health”
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1762
			lastTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1763
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1764
			-- Normal assignment of ABL variable
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1765
			lastTeam = teamHealths[1].name
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1766
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1767
		if teamHealths[#teamHealths].health == teamHealths[#teamHealths-1].health then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1768
			-- KTL rule is disabled if it's a tie for “most health”
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1769
			leaderTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1770
			runnerUpTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1771
		else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1772
			-- Normal assignment of KTL variables
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1773
			leaderTeam = teamHealths[#teamHealths].name
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1774
			runnerUpTeam = teamHealths[#teamHealths-1].name
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1775
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1776
	else
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1777
		-- The KTL and ABL rules are disabled with only 2 teams left
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1778
		lastTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1779
		runnerUpTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1780
		leaderTeam = nil
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1781
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1782
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1783
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1784
function UpdateTeamHealth(team)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1785
	setTeamValue(team, "totalHealth", 0)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1786
	runOnHogsInTeam(function(hog)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1787
		if(GetGearType(hog) ~= gtHedgehog) then return end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1788
		local h = getTeamValue(GetHogTeamName(hog), "totalHealth")
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1789
		setTeamValue(GetHogTeamName(hog), "totalHealth", h + GetHealth(hog))
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1790
	end, team)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1791
end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1792
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1793
-- Check if the ABL or KTL rule (if active) has been violated by teamToCheck
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1794
function CheckAttackRuleViolation(teamToCheck)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1795
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1796
	if teamToCheck == nil then return end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1797
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1798
	local violated = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1799
	if attackRule == "ABL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1800
		-- We don't care if the last team hurts itself
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1801
		if lastTeam ~= nil and lastTeam ~= teamToCheck then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1802
			local lastAttacked = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1803
			local attackNum = 0	-- count the attacked teams but we'll ignore the attacking team
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1804
			for team, wasAttacked in pairs(teamsAttacked) do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1805
				-- Ignore the attacking team
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1806
				if team ~= teamToCheck then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1807
					attackNum = attackNum + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1808
					if team == lastTeam then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1809
						lastAttacked = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1810
					end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1811
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1812
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1813
			-- Rule is violated iff only the last team is attacked (damage to attacking team is ignored)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1814
			if attackNum == 1 and lastAttacked then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1815
				violated = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1816
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1817
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1818
		if violated then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1819
			AddCaption(string.format(loc("%s violated the “All But Last” rule and will be penalized."), teamToCheck), msgColorWarn, capgrpGameState)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1820
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1821
	elseif attackRule == "KTL" then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1822
		local leaderAttacked = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1823
		if leaderTeam ~= nil then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1824
			local attackNum = 0
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1825
			local selfHarm = false
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1826
			for team, wasAttacked in pairs(teamsAttacked) do
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1827
				attackNum = attackNum + 1
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1828
				if team == teamToCheck then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1829
					selfHarm = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1830
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1831
				-- The leader must attack the runner-up, everyone else must attack the leader
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1832
				if (teamToCheck ~= leaderTeam and team == leaderTeam) or (teamToCheck == leaderTeam and team == runnerUpTeam) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1833
					leaderAttacked = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1834
					break
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1835
				end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1836
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1837
			-- If teams were attacked but not the leader, it is a violation,
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1838
			-- but we don't care if the team *only* harmed itself.
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1839
			if (attackNum >= 2 and not leaderAttacked) or (attackNum == 1 and not selfHarm and not leaderAttacked) then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1840
				violated = true
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1841
			end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1842
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1843
		if violated then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1844
			AddCaption(string.format(loc("%s violated the “Kill The Leader” rule and will be penalized."), teamToCheck), msgColorWarn, capgrpGameState)
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1845
		end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1846
	end
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1847
	if violated then
7df7c58ea965 WxW: Selectable walls, support more maps, more liberal game schemes, new rules, script parameter, better menu
Wuzzy <almikes@aol.com>
parents: 11301
diff changeset
  1848
		setTeamValue(teamToCheck, "skipPenalty", true)
7095
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1849
	end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1850
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1851
end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1852
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1853
function onAmmoStoreInit()
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1854
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1855
	for i, w in pairs(ropeWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1856
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1857
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1858
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1859
    for i, w in pairs(groundWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1860
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1861
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1862
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1863
    for i, w in pairs(crazyWeps) do
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1864
        SetAmmo(w, 0, 0, 0, 1)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1865
    end
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1866
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1867
	SetAmmo(amRope, 9, 0, 0, 0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1868
	SetAmmo(amSkip, 9, 0, 0, 0)
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1869
b20dfa82f453 + Trivial update.
mikade <redgrinner@gmail.com>
parents:
diff changeset
  1870
end