269 |
269 |
270 local pMode = {} -- pMode contains custom subsets of the main categories |
270 local pMode = {} -- pMode contains custom subsets of the main categories |
271 local pIndex = 1 |
271 local pIndex = 1 |
272 |
272 |
273 local currentGirderRotation = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used |
273 local currentGirderRotation = 1 -- current girder rotation, we actually need this as HW remembers what rotation you last used |
|
274 |
|
275 -- Returns true if ammoType is an ammo type with a special meaning |
|
276 -- in Construction Mode. |
|
277 function IsConstructionModeAmmo(ammoType) |
|
278 return ammoType == amCMStructurePlacer or |
|
279 ammoType == amCMObjectPlacer or |
|
280 ammoType == amCMCratePlacer or |
|
281 ammoType == amGirder or |
|
282 ammoType == amRubber or |
|
283 ammoType == amTeleport |
|
284 end |
274 |
285 |
275 function DrawClanPowerTag() |
286 function DrawClanPowerTag() |
276 |
287 |
277 local zoomL = 1.1 |
288 local zoomL = 1.1 |
278 local xOffset = 45 |
289 local xOffset = 45 |
706 elseif strucType[sID] == "Weapon Filter" then |
717 elseif strucType[sID] == "Weapon Filter" then |
707 |
718 |
708 if GetGearType(gear) == gtHedgehog then |
719 if GetGearType(gear) == gtHedgehog then |
709 if (GetHogClan(gear) ~= strucClan[sID]) then |
720 if (GetHogClan(gear) ~= strucClan[sID]) then |
710 |
721 |
711 for wpnIndex = 1, #atkArray do |
722 -- Vaporize (almost) all of the hog's ammo |
712 AddAmmo(gear, atkArray[wpnIndex][1], 0) |
723 |
|
724 local ammosDestroyed = 0 |
|
725 for wpnIndex = 0, AmmoTypeMax do |
|
726 if (not IsConstructionModeAmmo(wpnIndex)) and wpnIndex ~= amSkip and wpnIndex ~= amNothing then |
|
727 local count = GetAmmoCount(gear, wpnIndex) |
|
728 -- Infinite ammos are spared |
|
729 if count ~= 100 then |
|
730 ammosDestroyed = ammosDestroyed + count |
|
731 AddAmmo(gear, wpnIndex, 0) |
|
732 end |
|
733 end |
713 end |
734 end |
714 |
735 |
715 for wpnIndex = 1, #utilArray do |
736 if ammosDestroyed > 0 then |
716 AddAmmo(gear, utilArray[wpnIndex][1], 0) |
737 -- Vaporize effects |
|
738 if gear == CurrentHedgehog then |
|
739 local r = math.random(1, 2) |
|
740 if r == 1 then |
|
741 PlaySound(sndNutter, gear) |
|
742 else |
|
743 PlaySound(sndOops, gear) |
|
744 end |
|
745 end |
|
746 PlaySound(sndVaporize) |
|
747 for i=1, 5 do |
|
748 AddVisualGear(GetX(gear), GetY(gear), vgtSmoke, 0, false) |
|
749 end |
|
750 |
|
751 local msgs = { |
|
752 loc("%s lost all the weapons"), |
|
753 loc("The ammo of %s has been vaporized"), |
|
754 loc("%s to a weapon filter"), |
|
755 loc("%s is suddenly low on ammo"), |
|
756 loc("%s is now as poor as a church mouse"), |
|
757 } |
|
758 local r = math.random(1, #msgs) |
|
759 AddCaption(string.format(msgs[r], GetHogName(gear))) |
717 end |
760 end |
718 |
|
719 AddAmmo(gear, amCMStructurePlacer, 100) |
|
720 AddAmmo(gear, amSkip, 100) |
|
721 |
761 |
722 end |
762 end |
723 end |
763 end |
724 |
764 |
725 -- BOUNCE! POGO! POGO! POGO! POGO! |
765 -- BOUNCE! POGO! POGO! POGO! POGO! |