| 128 | | end |
| 129 | | --]] |
| 130 | | |
| 131 | | |
| 132 | | function gadget:UnitCreated(unitID, unitDefID, unitTeam) |
| 133 | | |
| 134 | | |
| 135 | | --Spring.SendMessage("Initializing team "..unitTeam.." with "..metal) |
| 136 | | |
| 137 | | if teamsToBoost[unitTeam] then |
| 138 | | local unitName = unitDefID and UnitDefs[unitDefID].name |
| 139 | | if unitName and boostUnits[unitName] then |
| 140 | | local metal = Spring.GetTeamResources(unitTeam, 'metal') |
| 141 | | |
| 142 | | Spring.SetTeamResource(unitTeam, 'energy', 0) |
| 143 | | Spring.SetTeamResource(unitTeam, 'metal', 0) |
| 144 | | |
| 145 | | --[[ |
| 146 | | if Spring.GetModOptions().commtype ~= 'con' then |
| 147 | | Spring.SetTeamResource(unitTeam, 'ms', START_STORAGE) |
| 148 | | Spring.SetTeamResource(unitTeam, 'es', START_STORAGE) |
| 149 | | end |
| 150 | | --]] |
| 151 | | |
| 152 | | boost[unitID] = metal |
| 153 | | startMetal[unitID] = metal |
| 154 | | --Spring.SendMessage("for unit " ..unitID) |
| 155 | | SendToUnsynced("UpdateBoost", unitID, metal, metal) |
| 156 | | |
| 157 | | teamsToBoost[unitTeam] = nil |
| 158 | | |
| 159 | | end |
| 160 | | end |
| 161 | | |
| 162 | | end |
| 163 | | |
| 164 | | function gadget:Initialize() |
| 165 | | |
| 166 | | for _, teamID in pairs(Spring.GetTeamList()) do |
| 167 | | local gaiaID = Spring.GetGaiaTeamID() |
| 168 | | local teamLuaAI = Spring.GetTeamLuaAI(teamID) |
| 169 | | if (teamID ~= gaiaID and (not teamLuaAI or teamLuaAI == "")) then |
| 170 | | teamsToBoost[teamID] = true |
| 171 | | end |
| 172 | | end |
| 173 | | |
| 174 | | if Spring.GetModOptions().commtype == 'con' then |
| 175 | | boostUnits = { |
| 176 | | armrectr = 1, |
| 177 | | armch = 1, |
| 178 | | arm_conveh = 1, |
| 179 | | armcs = 1, |
| 180 | | |
| 181 | | cornecro = 1, |
| 182 | | corch = 1, |
| 183 | | corned = 1, |
| 184 | | corcs = 1, |
| 185 | | |
| 186 | | --chicken_drone = 1, |
| 187 | | } |
| 188 | | else |
| 189 | | boostUnits = { |
| 190 | | armcom = 1, |
| 191 | | corcom = 1, |
| 192 | | } |
| 193 | | end |