1022 local cGear = nil -- detects placement of girders and objects (using airattack) |
1022 local cGear = nil -- detects placement of girders and objects (using airattack) |
1023 local curWep = amNothing |
1023 local curWep = amNothing |
1024 |
1024 |
1025 -- primary placement categories |
1025 -- primary placement categories |
1026 local cIndex = 1 -- category index |
1026 local cIndex = 1 -- category index |
1027 local cat = { |
1027 local cat = { |
1028 "Girder Placement Mode", |
1028 "Girder Placement Mode", |
1029 "Rubber Placement Mode", |
1029 "Rubber Placement Mode", |
1030 "Mine Placement Mode", |
1030 "Mine Placement Mode", |
1031 "Sticky Mine Placement Mode", |
1031 "Sticky Mine Placement Mode", |
1032 "Barrel Placement Mode", |
1032 "Barrel Placement Mode", |
1033 "Weapon Crate Placement Mode", |
1033 "Weapon Crate Placement Mode", |
1034 "Utility Crate Placement Mode", |
1034 "Utility Crate Placement Mode", |
1035 "Health Crate Placement Mode", |
1035 "Health Crate Placement Mode", |
1036 "Structure Placement Mode" |
1036 "Structure Placement Mode" |
1037 } |
1037 } |
1038 |
1038 local catReverse = {} |
1039 |
1039 for c=1, #cat do |
1040 sProx = { |
1040 catReverse[cat[c]] = c |
1041 {loc("Girder Placement Mode"),false}, |
1041 end |
1042 {loc("Rubber Placement Mode"),false}, |
1042 |
1043 {loc("Mine Placement Mode"),false}, |
1043 sProx = { |
1044 {loc("Sticky Mine Placement Mode"),false}, |
1044 {loc("Girder Placement Mode"),false}, |
1045 {loc("Barrel Placement Mode"),false}, |
1045 {loc("Rubber Placement Mode"),false}, |
1046 {loc("Weapon Crate Placement Mode"),false}, |
1046 {loc("Mine Placement Mode"),false}, |
1047 {loc("Utility Crate Placement Mode"),false}, |
1047 {loc("Sticky Mine Placement Mode"),false}, |
1048 {loc("Health Crate Placement Mode"),false}, |
1048 {loc("Barrel Placement Mode"),false}, |
1049 {loc("Structure Placement Mode"),false}, |
1049 {loc("Weapon Crate Placement Mode"),false}, |
1050 {loc("Teleportation Mode"),false} |
1050 {loc("Utility Crate Placement Mode"),false}, |
1051 } |
1051 {loc("Health Crate Placement Mode"),false}, |
|
1052 {loc("Structure Placement Mode"),false}, |
|
1053 {loc("Teleportation Mode"),false}, |
|
1054 } |
1052 |
1055 |
1053 |
1056 |
1054 local pMode = {} -- pMode contains custom subsets of the main categories |
1057 local pMode = {} -- pMode contains custom subsets of the main categories |
1055 local pIndex = 1 |
1058 local pIndex = 1 |
1056 |
1059 |
1280 |
1283 |
1281 if wallsVisible == true then |
1284 if wallsVisible == true then |
1282 HandleBorderEffects() |
1285 HandleBorderEffects() |
1283 end |
1286 end |
1284 |
1287 |
1285 if (CurrentHedgehog ~= nil) and (TurnTimeLeft ~= TurnTime) then |
1288 if (TurnTimeLeft ~= TurnTime) then |
1286 if (lastWep ~= GetCurAmmoType()) then |
1289 if (lastWep ~= GetCurAmmoType()) then |
1287 checkForSpecialWeapons() |
1290 checkForSpecialWeapons() |
1288 elseif checkForSpecialWeaponsIn == 0 then |
1291 elseif checkForSpecialWeaponsIn == 0 then |
1289 checkForSpecialWeapons() |
1292 checkForSpecialWeapons() |
1290 checkForSpecialWeaponsIn = -1 |
1293 checkForSpecialWeaponsIn = -1 |
1295 |
1298 |
1296 if GameTime % 100 == 0 then |
1299 if GameTime % 100 == 0 then |
1297 |
1300 |
1298 DrawClanPowerTag() |
1301 DrawClanPowerTag() |
1299 |
1302 |
1300 curWep = GetCurAmmoType() |
1303 |
1301 |
1304 -- Update display selection criteria |
1302 -- change to girder mode on weapon swap |
1305 if (band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then |
1303 if (cIndex ~= 1) and (curWep == amGirder) then |
1306 curWep = GetCurAmmoType() |
1304 cIndex = 1 |
1307 |
1305 RedefineSubset() |
1308 local updated = false |
1306 elseif (cIndex ~=2) and (curWep == amRubber) then |
1309 local team = GetHogTeamName(CurrentHedgehog) |
1307 cIndex = 2 |
1310 if (curWep == amGirder) then |
1308 RedefineSubset() |
1311 cIndex = 1 |
1309 -- change to generic mode if girder no longer selected |
1312 RedefineSubset() |
1310 elseif (cIndex == 1) and (curWep ~= amGirder) then |
1313 updated = true |
1311 cIndex = 3 |
1314 elseif (curWep == amRubber) then |
1312 RedefineSubset() |
1315 cIndex = 2 |
1313 elseif (cIndex == 2) and (curWep ~= amRubber) then |
1316 RedefineSubset() |
1314 cIndex = 3 |
1317 updated = true |
1315 RedefineSubset() |
1318 elseif (curWep == amCMStructurePlacer) then |
1316 |
1319 cIndex = 9 |
1317 end |
1320 RedefineSubset() |
1318 |
1321 updateCost() |
1319 -- update display selection criteria |
1322 updated = true |
1320 if ((curWep == amGirder) or (curWep == amCMStructurePlacer) or (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) or (curWep == amRubber)) |
1323 elseif (curWep == amCMCratePlacer) then |
1321 and (CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0) then |
1324 cIndex = catReverse[teamLCrateMode[team]] |
1322 |
1325 RedefineSubset() |
1323 ---------------hooolllllyyyy fucking shit this |
1326 updateCost() |
1324 -- code is a broken mess now |
1327 updated = true |
1325 -- it was redesigned and compromised three times |
1328 elseif (curWep == amCMObjectPlacer) then |
1326 -- so now it is a mess trying to do what it was |
1329 cIndex = catReverse[teamLObjectMode[team]] |
1327 -- never designed to do |
1330 RedefineSubset() |
1328 -- needs to be rewritten badly sadface |
1331 updateCost() |
1329 -- this bit here catches the new 3 types of weapons |
1332 updated = true |
1330 if ((sProx[cIndex][1] == loc("Structure Placement Mode") and (curWep ~= amCMStructurePlacer))) then |
|
1331 updatePlacementDisplay(1) |
|
1332 elseif (sProx[cIndex][1] == loc("Health Crate Placement Mode")) or |
|
1333 (sProx[cIndex][1] == loc("Weapon Crate Placement Mode")) or |
|
1334 (sProx[cIndex][1] == loc("Utility Crate Placement Mode")) then |
|
1335 if curWep ~= amCMCratePlacer then |
|
1336 updatePlacementDisplay(1) |
|
1337 end |
|
1338 |
|
1339 elseif (sProx[cIndex][1] == loc("Mine Placement Mode")) or |
|
1340 (sProx[cIndex][1] == loc("Sticky Mine Placement Mode")) or |
|
1341 (sProx[cIndex][1] == loc("Barrel Placement Mode")) then |
|
1342 if curWep ~= amCMObjectPlacer then |
|
1343 updatePlacementDisplay(1) |
|
1344 end |
|
1345 |
|
1346 end |
1333 end |
1347 |
1334 |
1348 --this is called when it happens that we have placement |
1335 if updated then |
1349 --mode selected and we are looking at something |
1336 AddCaption(loc(cat[cIndex]), 0xffba00ff, capgrpMessage) |
1350 --we shouldn't be allowed to look at, as would be the case |
1337 showModeMessage() |
1351 --when you WERE allowed to look at it, but then maybe |
1338 wallsVisible = true |
1352 --a bomb blows up the structure that was granting you |
|
1353 --that ability |
|
1354 if (sProx[cIndex][2] ~= true) then |
|
1355 updatePlacementDisplay(1) |
|
1356 else |
1339 else |
1357 updateCost() |
1340 wallsVisible = false |
1358 end |
1341 end |
1359 |
|
1360 |
|
1361 AddCaption(loc(cat[cIndex]),0xffba00ff,capgrpMessage) |
|
1362 showModeMessage() |
|
1363 wallsVisible = true |
|
1364 else |
1342 else |
|
1343 curWep = amNothing |
1365 wallsVisible = false |
1344 wallsVisible = false |
1366 end |
1345 end |
1367 |
1346 |
1368 end |
1347 end |
1369 |
1348 |
1505 |
1484 |
1506 -- Update team variables so the previous state can be restored later |
1485 -- Update team variables so the previous state can be restored later |
1507 if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end |
1486 if CurrentHedgehog == nil or band(GetState(CurrentHedgehog), gstHHDriven) == 0 then return end |
1508 local val = pMode[pIndex] |
1487 local val = pMode[pIndex] |
1509 local team = GetHogTeamName(CurrentHedgehog) |
1488 local team = GetHogTeamName(CurrentHedgehog) |
1510 if cat[cIndex] == "Mine Placement Mode" then |
1489 if cat[cIndex] == "Structure Placement Mode" then |
|
1490 teamLStructIndex[team] = pIndex |
|
1491 elseif cat[cIndex] == "Mine Placement Mode" then |
1511 teamLMineIndex[team] = pIndex |
1492 teamLMineIndex[team] = pIndex |
1512 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1493 elseif cat[cIndex] == "Weapon Crate Placement Mode" then |
1513 teamLWeapIndex[team] = pIndex |
1494 teamLWeapIndex[team] = pIndex |
1514 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1495 elseif cat[cIndex] == "Utility Crate Placement Mode" then |
1515 teamLUtilIndex[team] = pIndex |
1496 teamLUtilIndex[team] = pIndex |
1583 -- health/weapon/utility crate, placement of gears |
1564 -- health/weapon/utility crate, placement of gears |
1584 --------------------------------------------------------- |
1565 --------------------------------------------------------- |
1585 function onUp() |
1566 function onUp() |
1586 |
1567 |
1587 if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
1568 if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
1588 if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
1569 if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
1589 updatePlacementDisplay(-1) |
1570 updatePlacementDisplay(-1) |
1590 end |
1571 end |
1591 end |
1572 end |
1592 |
1573 |
1593 end |
1574 end |
1594 |
1575 |
1595 function onDown() |
1576 function onDown() |
1596 |
1577 |
1597 if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
1578 if ( (curWep == amCMCratePlacer) or (curWep == amCMObjectPlacer) ) then |
1598 if CurrentHedgehog ~= nil or band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
1579 if CurrentHedgehog ~= nil and band(GetState(CurrentHedgehog), gstHHDriven) ~= 0 then |
1599 updatePlacementDisplay(1) |
1580 updatePlacementDisplay(1) |
1600 end |
1581 end |
1601 end |
1582 end |
1602 |
1583 |
1603 end |
1584 end |