share/hedgewars/Data/Scripts/Multiplayer/Balanced_Random_Weapon.lua
author unC0Rr
Fri, 19 Apr 2024 17:45:05 +0200
changeset 16011 52b51d92e88d
parent 14524 b5618fa33a49
permissions -rw-r--r--
Fix build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     1
--[[
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     2
Balanced Random Weapon
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     3
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     4
Every turn, each hog gets 1-3 random weapons. Weapons are reset every turn.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     5
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     6
= CUSTOMIZATION =
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     7
The weapon chances are chosen with the weapons scheme.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     8
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
     9
The "ammo count" tab is used to set the probability level that you get
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    10
equipped with the ammo at the start of a turn:
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    11
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    12
* infinity = always get this weapon
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    13
* 3-8 bullets = high probability (more bullets don't make it more likely)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    14
* 2 bullets = medium probability
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    15
* 1 bullet = low probability
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    16
* 0 bullets = never
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    17
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    18
For utilities, the low and medium probabilities are the same.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    19
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    20
The "probabilities" tab is, as usual, for crate probabilities.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    21
The "ammo in crate" and "delay" tabs also work as expected.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    22
]]
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    23
8043
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
    24
HedgewarsScriptLoad("/Scripts/Locale.lua")
da083f8d95e6 We need custom script loading function in lua now
unc0rr
parents: 5827
diff changeset
    25
HedgewarsScriptLoad("/Scripts/Tracker.lua")
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
    26
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    27
local weapons = {}
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    28
local weapons_values = {}
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
    29
local weapons_count = 0
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    30
local utilities = {}
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    31
local utilities_values = {}
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    32
local utilities_count = 0
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    33
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    34
local gotten_air_weapons = {}
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
    35
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    36
local isUtility, isAirWeapon
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
    37
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    38
function randomAmmo()
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    39
--[[
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    40
= WEAPON SELECTION ALGORITHM =
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    41
Each turn, a team gets 3 "points". Each ammo that has been activated
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    42
has a "cost" of 1-3 which is derived from the ammo probability specified
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    43
from the ammo menu (see getCost).
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    44
Utilities are forced to have a cost of 1-2.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    45
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    46
Steps:
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    47
1. Add a random weapon to ammo and subtract cost
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    48
2. If there's still points left:
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    49
    a. Forget any item in mind
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    50
    b. Choose a random weapon and keep it in mind (but don't add it to the ammo yet)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    51
    c. Choose a random utility and keep it in mind (but don't add it to the ammo yet)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    52
    d. Forget any items which are either too expensive or have already been taken by this hedgehog
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    53
    e. Randomly add one of the items which are still in mind to the hedgehog's ammo and substract cost
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    54
    f. Return to step 2
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    55
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    56
If 0 points are left, the algorithm terminates.
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    57
]]
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    58
    local picked_items = {}
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
    59
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    60
    local n = 3   --"points" to be allocated on weapons
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
    61
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    62
    --pick random weapon and subtract cost
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    63
    if weapons_count > 0 then
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    64
        local r = GetRandom(weapons_count) + 1
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    65
        table.insert(picked_items, weapons[r])
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    66
        n = n - weapons_values[r]
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    67
    elseif utilities_count > 0 then
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    68
        local r = GetRandom(utilities_count) + 1
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    69
        table.insert(picked_items, utilities[r])
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    70
        n = n - utilities_values[r]
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    71
    else
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    72
        return picked_items
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
    73
    end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
    74
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    75
    --choose any weapons or utilities to use up remaining n
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
    76
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    77
    while n > 0 do
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    78
        local items = {}
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    79
        local items_values = {}
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
    80
        local items_count = 0
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    81
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    82
        for i, w in pairs(weapons_values) do
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    83
            local used = false
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    84
            if w <= n then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    85
                --check that this weapon hasn't been given already
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    86
                for j, k in pairs(picked_items) do
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    87
                    if weapons[i] == k then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    88
                        used = true
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    89
                    end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    90
                end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    91
                if not used then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    92
                    table.insert(items_values, w)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    93
                    table.insert(items, weapons[i])
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
    94
                    items_count = items_count + 1
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    95
                end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    96
            end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    97
        end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    98
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
    99
        for i, w in pairs(utilities_values) do
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   100
            local used = false
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   101
            if w <= n then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   102
                --check that this weapon hasn't been given already
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   103
                for j, k in pairs(picked_items) do
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   104
                    if utilities[i] == k then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   105
                        used = true
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   106
                    end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   107
                end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   108
                if not used then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   109
                    table.insert(items_values, w)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   110
                    table.insert(items, utilities[i])
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   111
                    items_count = items_count + 1
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   112
                end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   113
            end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   114
        end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
   115
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   116
        if items_count > 0 then
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   117
            local r = GetRandom(items_count) + 1
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   118
            table.insert(picked_items, items[r])
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   119
            n = n - items_values[r]
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   120
        else
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   121
            break
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   122
        end
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   123
    end
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
   124
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   125
    return picked_items
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   126
end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   127
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   128
function assignAmmo(hog)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   129
    local name = GetHogTeamName(hog)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   130
    local processed = getTeamValue(name, "processed")
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   131
    if processed == nil or not processed then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   132
        local ammo = getTeamValue(name, "ammo")
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   133
        if ammo == nil then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   134
            ammo = randomAmmo()
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   135
            setTeamValue(name, "ammo", ammo)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   136
        end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   137
        for i, w in pairs(ammo) do
13718
7284233d9132 Fix BRW adding ammoInCrate times ammo on start of turn instead of 1
Wuzzy <Wuzzy2@mail.ru>
parents: 13717
diff changeset
   138
            AddAmmo(hog, w, 1)
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   139
        end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   140
        setTeamValue(name, "processed", true)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   141
    end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   142
end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   143
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   144
function reset(hog)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   145
    setTeamValue(GetHogTeamName(hog), "processed", false)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   146
end
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   147
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   148
function onGameInit()
13720
8e3d2f7d8737 Force-disable gfPerHogAmmo and gfSharedAmmo for RW and BRW
Wuzzy <Wuzzy2@mail.ru>
parents: 13719
diff changeset
   149
    DisableGameFlags(gfPerHogAmmo, gfSharedAmmo)
10036
3be36d2fdca6 use new API for changing GameFlags
sheepluva
parents: 8043
diff changeset
   150
    EnableGameFlags(gfResetWeps)
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   151
    Goals = loc("Each turn you get 1-3 random weapons")
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   152
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   153
    isUtility = {
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   154
        [amTeleport] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   155
        [amGirder] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   156
        [amSwitch] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   157
        [amLowGravity] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   158
        [amResurrector] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   159
        [amRope] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   160
        [amParachute] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   161
        [amJetpack] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   162
        [amPortalGun] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   163
        [amRubber] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   164
        [amTardis] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   165
        [amLandGun] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   166
        [amExtraTime] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   167
        [amVampiric] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   168
        [amLaserSight] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   169
        [amExtraDamage] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   170
        [amInvulnerable] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   171
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   172
        -- unusual classification
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   173
        [amSnowball] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   174
    }
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   175
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   176
    isAirWeapon = {
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   177
        [amAirAttack] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   178
        [amMineStrike] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   179
        [amNapalm] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   180
        [amDrillStrike] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   181
        [amPiano] = true,
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   182
    }
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   183
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   184
end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   185
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   186
local function getCost(ammoType, ammoCount)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   187
    if ammoCount == 0 or ammoCount == 9 then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   188
        return 0
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   189
    else
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   190
        local max
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   191
        if isUtility[ammoType] then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   192
            -- Force-limit cost of utilities to 2 because utilities with
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   193
            -- a cost of 3 could never be "paid"
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   194
            max = 2
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   195
        else
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   196
            max = 3
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   197
        end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   198
        return math.max(1, math.min(max, 4 - ammoCount))
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   199
    end
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   200
end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   201
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   202
function onGameStart()
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   203
    trackTeams()
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   204
    -- Add air weapons
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   205
    if MapHasBorder() == false then
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   206
        for a = 0, AmmoTypeMax do
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   207
            if isAirWeapon[a] then
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   208
                local gotten = gotten_air_weapons[a]
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   209
                local ammoCount, prob, delay, ammoInCrate = gotten[1], gotten[2], gotten[3], gotten[4]
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   210
                local cost = getCost(a, ammoCount)
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   211
                if cost > 0 then
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   212
                    table.insert(weapons, a)
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   213
                    table.insert(weapons_values, cost)
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   214
                    weapons_count = weapons_count + 1
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   215
                end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   216
            end
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   217
        end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   218
    end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   219
end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   220
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   221
function onAmmoStoreInit()
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   222
    SetAmmo(amSkip, 9, 0, 0, 0)
5827
a416f1070fdf we don't need trailing whitespaces... I guess :P
sheepluva
parents: 5141
diff changeset
   223
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   224
    for a=0, AmmoTypeMax do
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   225
        if a ~= amNothing and a ~= amSkip then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   226
            local ammoCount, prob, delay, ammoInCrate = GetAmmo(a)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   227
            if (not isAirWeapon[a]) then
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   228
                local cost = getCost(a, ammoCount)
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   229
                if cost > 0 then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   230
                    if isUtility[a] then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   231
                        table.insert(utilities, a)
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   232
                        table.insert(utilities_values, cost)
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   233
                        utilities_count = utilities_count + 1
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   234
                    else
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   235
                        table.insert(weapons, a)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   236
                        table.insert(weapons_values, cost)
13717
ed22eb551a75 Fix BRW breaking when weapon scheme assigns 2 bullet for all ammos
Wuzzy <Wuzzy2@mail.ru>
parents: 13716
diff changeset
   237
                        weapons_count = weapons_count + 1
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   238
                    end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   239
                end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   240
            else
13719
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   241
                -- air weapons are handled in onGameStart
7edaeca8f816 BRW: Add utilities and air weapons properly
Wuzzy <Wuzzy2@mail.ru>
parents: 13718
diff changeset
   242
                gotten_air_weapons[a] = { ammoCount, prob, delay, ammoInCrate }
13716
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   243
            end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   244
            local realAmmoCount
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   245
            if ammoCount ~= 9 then
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   246
                realAmmoCount = 0
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   247
            else
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   248
                realAmmoCount = 1
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   249
            end
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   250
            SetAmmo(a, realAmmoCount, prob, delay, ammoInCrate)
6d57f5f61c09 BRW now allows weapon scheme customization
Wuzzy <Wuzzy2@mail.ru>
parents: 13173
diff changeset
   251
        end
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   252
    end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   253
end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   254
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   255
function onNewTurn()
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   256
    runOnGears(assignAmmo)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   257
    runOnGears(reset)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   258
    setTeamValue(GetHogTeamName(CurrentHedgehog), "ammo", nil)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   259
end
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   260
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   261
function onGearAdd(gear)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   262
    if GetGearType(gear) == gtHedgehog then
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   263
        trackGear(gear)
5127
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   264
    end
b0b6f17a6a3c added Balanced Random Weapon gameplay script
claymore
parents:
diff changeset
   265
end
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   266
14524
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   267
function onHogHide(gear)
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   268
    trackHiding(gear)
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   269
end
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   270
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   271
function onHogRestore(gear)
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   272
    trackRestoring(gear)
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   273
end
b5618fa33a49 BRW: Fix Lua error after using timebox
Wuzzy <Wuzzy2@mail.ru>
parents: 13720
diff changeset
   274
5141
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   275
function onGearDelete(gear)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   276
    trackDeletion(gear)
2fb6555011d3 cleared up Random Weapons and implemented remembering of weapons in Balanced Random Weapons too, also seems to work
Henek
parents: 5127
diff changeset
   277
end